[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: xorg-server/*bsd: moving from hal support to devd support?

Hi Dan,

Dan Nicholson <dbn.lists@gmail.com> (13/02/2011):
> As someone who's worked on the udev backend for input devices, what
> needs to be provided is pretty simple.


> 1. X needs to know about devices that are already plugged in when
> the server starts

I haven't looked yet, but probably not the hardest part.

> 2. X needs to get events for devices when they are inserted or
> removed

I think that's one of the core point, but apparently devd lets people
define actions to perform when “stuff” happens, based on system,
subsystem, bus, etc. Those actions can then use variables like
$device, $class, $vendor, $product, etc. Looks like a good start.

All variables are listed on:

below “Variables that can be used with the match statement” (around
the middle of the page).

> 3. X needs a basic level of metadata about the device to allow the
> user to match to the device. Basically, filling out the
> InputAttributes struct (see include/input.h):
> typedef struct _InputAttributes {
>     char                *product;
>     char                *vendor;
>     char                *device;
>     char                *pnp_id;
>     char                *usb_id;
>     char                **tags; /* null-terminated */

Should be trivial given what I wrote above.

>     uint32_t            flags;
> } InputAttributes;
> #define ATTR_KEYBOARD (1<<0)
> #define ATTR_POINTER (1<<1)
> #define ATTR_JOYSTICK (1<<2)
> #define ATTR_TABLET (1<<3)
> #define ATTR_TOUCHPAD (1<<4)
> #define ATTR_TOUCHSCREEN (1<<5)
> Where flags is currently just a bitfield for the ATTR_* macros and
> tags are freeform labels coming from the backend (optional). After
> that it gets handed off to the DDX.

Here, I guess pinging the kernel modules about $hardware they're
handling should be sufficient to get what we need.

Julien mentioned hal's hald/freebsd/probing/probe-hiddev.c on IRC, and
HID_USAGE2 seems to do what we want:
| ./hald/freebsd/probing/probe-hiddev.c:	  case HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE):
| ./hald/freebsd/probing/probe-hiddev.c:	  case HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_JOYSTICK):
| ./hald/freebsd/probing/probe-hiddev.c:	  case HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_GAME_PAD):
| ./hald/freebsd/probing/probe-hiddev.c:	  case HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_KEYBOARD):
| ./hald/freebsd/probing/probe-hiddev.c:	  case HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_KEYPAD):

So info to fill flags is apparently available, and just needs to be
used, either on the devd side to set some flags, or on X's side to
decide about devices to discard or take into account.

I'll try and get that to work.


Attachment: signature.asc
Description: Digital signature

Reply to: