On Tuesday 31 July 2012 05:19:12 Takanori Watanabe wrote:
> I'm trying to map USB devices and hub into acpi handle,
> and I want ideas to cope with a problem.
> 
> The problem is that there is no easy way to get port number from
> child usb device in hub device.
> usb_attach_arg structure have one, but invalidate after probe and attach.
> 
> And, furthermore, which device_t instance should I register to acpi
> device handle to cope with ACPI docking station framework.
> 
> The code I wrote is as follows.
> 

Hi,

In userspace there is:

man libusb20_dev_get_parent_port

Most of the information you need is supplied via either devd, or an IOCTL 
request on the ugen device: 

#define USB_DEVICEINFO          _IOWR('U', 4, struct usb_device_info)


...

        uint8_t udi_hubaddr;            /* parent HUB address */
        uint8_t udi_hubindex;           /* parent HUB device index */
        uint8_t udi_hubport;            /* parent HUB port */

...

Check how the DEVICEINFO IOCTL is implemented and you will see how the current 
port numbers are computed.

Important: Don't forget that the USB stack is multithreaded! And that you need 
to lock resources before accessing them!

Do you need more info than this?

--HPS
_______________________________________________
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"

Reply via email to