USB: always export interface information for modalias
RFC PATCH 1/1 USB: always export interface information for modalias
Here's a patch that is needed for systems that rely on udev to only load the modules. It seems that we were getting the modalias values wrong for some types of devices (I know it shows up for devices that use the cdc_acm driver). This patch should fix this.
If anyone objects to this, or it doesn't work for them, please let me know.
thanks,
greg k-h
-----------
From: Greg Kroah-Hartman <[email protected]>
Subject: [RFC PATCH] USB: always export interface information for modalias
This fixes a problem with some cdc acm devices that were not getting automatically loaded as the module alias was not being reported properly.
This check was for back in the days when we only reported hotplug events for the main usb device, not the interfaces. We should always give the interface information for MODALIAS/modalias as it can be needed.
--- drivers/usb/core/sysfs.c | 33 +++++++++--------------- drivers/usb/core/usb.c | 63 +++++++++++++++++------------------------------ 2 files changed, 36 insertions(+), 60 deletions(-)
drivers/usb/core/sysfs.c +13 -20
@@ -462,30 +462,23 @@ static ssize_t show_modalias(struct devi {struct usb_interface *intf;struct usb_device *udev; -int len; +struct usb_host_interface *alt; intf =to_usb_interface (dev); udev =interface_to_usbdev (intf); + alt = intf->cur_altsetting; - len =sprintf (buf,"usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic" , -le16_to_cpu (udev->descriptor.idVendor), -le16_to_cpu (udev->descriptor.idProduct), -le16_to_cpu (udev->descriptor.bcdDevice), - udev->descriptor.bDeviceClass, - udev->descriptor.bDeviceSubClass, - udev->descriptor.bDeviceProtocol); - buf += len; - -if (udev->descriptor.bDeviceClass ==0 ) { -struct usb_host_interface *alt = intf->cur_altsetting; - -return len +sprintf (buf,"%02Xisc%02Xip%02X\n" , - alt->desc.bInterfaceClass, - alt->desc.bInterfaceSubClass, - alt->desc.bInterfaceProtocol); - }else { -return len +sprintf (buf,"*isc*ip*\n" ); - } +return sprintf (buf,"usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02X" +"ic%02Xisc%02Xip%02X\n" , +le16_to_cpu (udev->descriptor.idVendor), +le16_to_cpu (udev->descriptor.idProduct), +le16_to_cpu (udev->descriptor.bcdDevice), + udev->descriptor.bDeviceClass, + udev->descriptor.bDeviceSubClass, + udev->descriptor.bDeviceProtocol, + alt->desc.bInterfaceClass, + alt->desc.bInterfaceSubClass, + alt->desc.bInterfaceProtocol); } static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
drivers/usb/core/usb.c +23 -40
82 lines not on this page · raw message