hotplugging with current modutils and usbd cvs
Hi there!
Here my experiences with hotplugging with modutils-2.4.1, linux-2.4.0 with the hotplug patch applied.
My devices plug well AFTER I add the matchflag to the read statement in the hotplug script. But for mousedev/joydev hotplugging I had to patch in the input-hotplug patch.
usb-storage and joydev does NOT hotplug, but I still use my local-usbmap approach to do this.
I attach the folowing files:
hotplug-local.patch
Patch for new modules.usbmap format and for local map support
usb-map.local
My local usbmap for usb-storage (sddr-31) and joydev for Logitech Wingman Digital Extreme
input.patch
The patch for automagically hotpluging of mousedev (and joydev?) From David Brownell
I hope that helps and we see improved usbd cvs scripts soon ;-)
Best wishes
Norbert
Signature · 8 lines
ciao norb +-------------------------------------------------------------------+ | Norbert Preining http://www.logic.at/people/preining | | University of Technology Vienna, Austria [email protected] | | DSA: 0x09C5B094 (RSA: 0xCF1FA165) mail subject: get [DSA|RSA]-key | +-------------------------------------------------------------------+
hotplug renamed from hotplug.orig +8 -1
@@ -132,6 +132,8 @@ PCI_MAP=$MODDIR/modules.pcimap USB_MAP=$MODDIR/modules.usbmap +USB_LOCAL_MAP=/etc/usb/usb-map.local + DRIVERS= ####################################################################
@@ -207,7 +209,7 @@ # NOTE: this match algorithm is just a filter; some drivers need # to look at the device for reasons other than paranoia - while read module idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol ignored + while read module matchflag idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol ignored do : checkmatch $module
@@ -362,6 +364,11 @@ if [ -f $2 ]; then $1_convert_vars $1_map_modules < $2 + if [ "$1" = "usb" ] ; then + if [ -f "$USB_LOCAL_MAP" ] ; then + usb_map_modules < $USB_LOCAL_MAP + fi + fi else mesg "$2 missing" exit 1
# usb module match_flag idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info joydev 0x0 0x046d 0xc207 0x0000 0x0000 0x00 0x00 0x00 0x03 0x00 0x00 0x00000000 usb-storage 0x0 0x0781 0x0002 0x0000 0x0000 0x00 0x00 0x00 0x08 0x06 0x50 0x00000000
drivers/input/joydev.c renamed from drivers/input-pre3/joydev.c +15 -0
@@ -86,6 +86,21 @@MODULE_DESCRIPTION ("Joystick device driver" );MODULE_SUPPORTED_DEVICE ("input/js" ); + +#ifdef CONFIG_HOTPLUG +#if defined(CONFIG_USB_HID ) || defined(CONFIG_USB_HID_MODULE ) +#include <linux/usb.h> + +static const struct usb_device_id usb_table [] = { +/* hid class, joystick protocol */ + { bInterfaceClass:3 , bInterfaceSubClass:1 , bInterfaceProtocol:4 }, + { }/* Terminating entry */ +}; +MODULE_DEVICE_TABLE (usb, usb_table); +#endif /* USB HID */ +#endif /* HOTPLUG */ + +static int joydev_correct (int value,struct js_corr *corr) {switch (corr->type) {
drivers/input/keybdev.c renamed from drivers/input-pre3/keybdev.c +13 -0
@@ -36,6 +36,19 @@#include <linux/module.h> #include <linux/kbd_kern.h> +#ifdef CONFIG_HOTPLUG +#if defined(CONFIG_USB_HID ) || defined(CONFIG_USB_HID_MODULE ) +#include <linux/usb.h> + +static const struct usb_device_id usb_table [] = { +/* hid class, keyboard protocol */ + { bInterfaceClass:3 , bInterfaceSubClass:1 , bInterfaceProtocol:1 }, + { }/* Terminating entry */ +}; +MODULE_DEVICE_TABLE (usb, usb_table); +#endif /* USB HID */ +#endif /* HOTPLUG */ +#if defined(CONFIG_X86 ) || defined(CONFIG_IA64 ) || defined(__alpha__) || defined(__mips__)static int x86_sysrq_alt =0 ;
drivers/input/mousedev.c renamed from drivers/input-pre3/mousedev.c +13 -0
@@ -48,6 +48,19 @@#define CONFIG_INPUT_MOUSEDEV_SCREEN_Y 768#endif +#ifdef CONFIG_HOTPLUG +#if defined(CONFIG_USB_HID ) || defined(CONFIG_USB_HID_MODULE ) +#include <linux/usb.h> + +static const struct usb_device_id usb_table [] = { +/* hid class, mouse protocol */ + { bInterfaceClass:3 , bInterfaceSubClass:1 , bInterfaceProtocol:2 }, + { }/* Terminating entry */ +}; +MODULE_DEVICE_TABLE (usb, usb_table); +#endif /* USB HID */ +#endif /* HOTPLUG */ +struct mousedev {int exist;int open;
Hi Norbert,
Try the package I just posted ... it incorporates updated versions of your patches (I've seen it hotplug mice and keyboards without a kernel patch, and has your joystick product/vendor codes), and has lots of other cleanup.
Notably, it switches entirely over to using /etc/hotplug; I'm not going to be touching /etc/usb/* again.
The newer scripts have been in CVS (linux-usb at sourceforge) for a while now, but they're in the "usbd/hotplug" directory instead of hte "usbd/etc" directory. They don't actually try to use the match_flags, or cope with "old" versions of "modules.usbmap" (without match_flags) ... volunteers?
- Dave
_______________________________________________
Linux-hotplug-devel mailing list
[email protected]
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel