Date: Tue, 31 Jul 2012 22:08:55 +0200 From: Hans Petter Selasky <hselasky@c2i.net> To: freebsd-acpi@freebsd.org Cc: freebsd-usb@freebsd.org Subject: Re: USB ACPI namespace mapping. Message-ID: <201207312208.55871.hselasky@c2i.net> In-Reply-To: <201207310319.q6V3JC6a014526@sana.init-main.com> References: <201207310319.q6V3JC6a014526@sana.init-main.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207312208.55871.hselasky>