Messages in this thread | | | Date | Sun, 20 Apr 2008 19:15:18 +0300 | From | Anssi Hannula <> | Subject | Re: HID bus |
| |
Jiri Slaby wrote: > Hmm, I must admit, I didn't know how exactly autoloading works. On suse, > at least, module aliases are used. So autoloading works for me after this > patch and slight modifications of the previous patches. The pro of this > is that it's in-kernel modification of modpost phase.
Indeed in current systems udev uses module aliases for autoloading.
> -- > > Generate aliases for usb hid device modules to support autoloading. > > Signed-off-by: Jiri Slaby <jirislaby@gmail.com> [...] > +/* Looks like: usb */
Looks like: "usb:vNpNd*dc*dsc*dp*ic3isc*ip*"
> +static int do_hid_usb_entry(const char *filename, > + struct hid_device_id *id, char *alias) > +{ > + __u16 v = TO_NATIVE((__u16)id->vendor); > + __u16 p = TO_NATIVE((__u16)id->product); > + > + strcpy(alias, "usb:"); > + ADD(alias, "v", id->vendor != HID_ANY_ID, v); > + ADD(alias, "p", id->product != HID_ANY_ID, p); > + > + sprintf(alias + strlen(alias), "d*dc*dsc*dp*ic%02Xisc*ip*", > + USB_INTERFACE_CLASS_HID); > + > + return 1; > +}
Oh, so we create a normal usb modalias entry anyway, not a custom 'usbhid:' one.
Why not just do something like
#define HID_DEVICE(vend, dev) \ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ USB_DEVICE_ID_MATCH_INT_CLASS, \ .idVendor = (vend), \ .idProduct = (prod), \ .bInterfaceClass = USB_INTERFACE_CLASS_HID (see linux/usb.h)
and use USB hotplugging?
Or do we plan to match against something else as well, such as hid reports or something?
-- Anssi Hannula
| |