Can't find HC device for a specific USB bus in sysfs (regression)

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

 



Using sysfs, it is no longer possible to obtain the host controller
device for a specific USB bus B (i.e.,
/sys/class/usb_host/usb_hostB/device).   This change to the sysfs API
has broken user space applications used to authenticate WUSB devices.

These programs (which use libusb 1.0) need to obtain the CHID of the
host controller that the WUSB device is connected to.

Can these sysfs files be reinstated?  Alternatively (but not preferred)
a symlink from the root hub device to the hcd device could be added.

David
---
usb: add "hcd" symlink to root hub device

Add a symlink to the hcd device from the root hub device.  This is
needed to obtain the WUSB CHID (in the HCD's wusb_chid file) to use
for a device attached to that root hub.

Signed-off-by: David Vrabel <david.vrabel@xxxxxxx>
---
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 95ccfa0..378056e 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2118,10 +2118,16 @@ int usb_add_hcd(struct usb_hcd *hcd,
 		       retval);
 		goto error_create_attr_group;
 	}
+	retval = sysfs_create_link(&rhdev->dev.kobj,
&hcd->self.controller->kobj, "hcd");
+	if (retval < 0) {
+		dev_err(&rhdev->dev, "Cannot add hcd sysfs link: %d\n", retval);
+		goto error_create_link;
+	}
 	if (hcd->uses_new_polling && hcd->poll_rh)
 		usb_hcd_poll_rh_status(hcd);
 	return retval;

+error_create_link:
 error_create_attr_group:
 	mutex_lock(&usb_bus_list_lock);
 	usb_disconnect(&hcd->self.root_hub);
@@ -2167,6 +2173,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
 	cancel_work_sync(&hcd->wakeup_work);
 #endif

+	sysfs_remove_link(&hcd->self.root_hub->dev.kobj, "hcd");
 	sysfs_remove_group(&hcd->self.root_hub->dev.kobj, &usb_bus_attr_group);
 	mutex_lock(&usb_bus_list_lock);
 	usb_disconnect(&hcd->self.root_hub);

-- 
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park,  Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ                 http://www.csr.com/


'member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom'
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux