[Linuxwacom-devel] [PATCH xf86-input-wacom 3/3] Add server managed fd handling

Hans de Goede hdegoede at redhat.com
Sat Mar 15 02:27:03 PDT 2014


Hi,

On 03/14/2014 10:52 PM, Jason Gerecke wrote:
> On Wed, Mar 12, 2014 at 8:12 AM, Hans de Goede <hdegoede at redhat.com> wrote:
>> This mostly consists of skipping common fd handling when server managed fds
>> are in used, the rest is handled by xf86OpenSerial and our wcmClose
>> xf86CloseSerial wrapper.
>>
>> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
>> ---
>
> I threw together a small virtual machine with the xserver from git,
> and noticed that after applying this patch some tools have trouble
> being spawned. I see the stylus device getting hotplugged, and then
> sucessfully creating a dependent eraser tool. The dependent cursor and
> pad tools that follow afterward throw an error while being created.
> The EVIOCGVERSION ioctl in usbDetect appears to be failing with EBADF.
> The file descriptor for these tools matches that of the stylus/eraser,
> so I'm a little confused at why we'd get EBADF at that point in time.

Thanks for testing. This indeed is weird. Can you see if there are
any systemd-logind messages in your /var/log/Xorg.0.log ?  If there
is only one about failing to take control of the session then the new
code paths are not being triggered at all, since then "XI86_SERVER_FD"
will not be set at all.

If there are non then you've compiled without systemd-logind support
and the same applies.

Have you tried without my patches, or at least without the latest patch?

Regards,

Hans



>
> Jason
> ---
> Now instead of four in the eights place /
> you’ve got three, ‘Cause you added one  /
> (That is to say, eight) to the two,     /
> But you can’t take seven from three,    /
> So you look at the sixty-fours....
>
>>   src/wcmConfig.c | 5 ++++-
>>   src/xf86Wacom.c | 9 +++++++++
>>   2 files changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/wcmConfig.c b/src/wcmConfig.c
>> index d19b9b4..9a3c8d7 100644
>> --- a/src/wcmConfig.c
>> +++ b/src/wcmConfig.c
>> @@ -634,7 +634,10 @@ InputDriverRec WACOM =
>>          wcmUninit, /* un-init */
>>          NULL,          /* module */
>>   #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
>> -       default_options
>> +       default_options,
>> +#endif
>> +#ifdef XI86_DRV_CAP_SERVER_FD
>> +       XI86_DRV_CAP_SERVER_FD,
>>   #endif
>>   };
>>
>> diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
>> index 3057d7a..4f41d64 100644
>> --- a/src/xf86Wacom.c
>> +++ b/src/xf86Wacom.c
>> @@ -578,6 +578,10 @@ static int wcmDevOpen(DeviceIntPtr pWcm)
>>
>>          DBG(10, priv, "\n");
>>
>> +       /* If fd management is done by the server, skip common fd handling */
>> +       if (pInfo->flags & XI86_SERVER_FD)
>> +               goto got_fd;
>> +
>>          /* open file, if not already open */
>>          if (common->fd_refs == 0)
>>          {
>> @@ -610,6 +614,7 @@ static int wcmDevOpen(DeviceIntPtr pWcm)
>>                  common->fd_refs++;
>>          }
>>
>> +got_fd:
>>          /* start the tablet data */
>>          if (model->Start && (model->Start(pInfo) != Success))
>>                  return !Success;
>> @@ -754,6 +759,10 @@ static void wcmDevClose(InputInfoPtr pInfo)
>>          WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
>>          WacomCommonPtr common = priv->common;
>>
>> +       /* If fd management is done by the server, skip common fd handling */
>> +       if (pInfo->flags & XI86_SERVER_FD)
>> +               return;
>> +
>>          DBG(4, priv, "Wacom number of open devices = %d\n", common->fd_refs);
>>
>>          if (pInfo->fd >= 0)
>> --
>> 1.9.0
>>
>>


More information about the xorg-devel mailing list