hub port power control vs. physical disconnect/connect

"Vlado Handziski" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Hi all,

To properly clean the internal state in the kernel modules, we are
currently manually unbinding the usb module attached to a hub port
device using sysfs before issuing a port power control command to a
hub using libusb. This is workig quite well, but it looks like the
removal of the actual port device is deferred until the port power on
command. When doing physical connect/disconnect this is not the case.
So what are we missing?  Is there a way to make the port power control
behave the same (create same sequence of UEVENTs) like in physical
connect/disconnect. Maybe some way to call usb_disconnect() in hub.c
from userspace?

Here is a log from udevmonitor to explain what I mean (FC6 2.6.22.14-72 kernel):

1. Physical connect/disconnect:

-> disconnect a device attached to port:
....
UEVENT[1197461939.623144]
remove@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1/5-7.1:1.0
UEVENT[1197461939.623350] remove@/class/usb_device/usbdev5.18
UEVENT[1197461939.623521] remove@/class/usb_endpoint/usbdev5.18_ep00
UEVENT[1197461939.623743] remove@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1
(end)
(note: last event is remove@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1)

-> attach the device back
...
UEVENT[1197461969.073000] add@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1
(note: first event is add@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1)
UEVENT[1197461969.073257] add@/class/usb_endpoint/usbdev5.19_ep00
UEVENT[1197461969.073640]
add@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1/5-7.1:1.0
...

2. Port power control:

-> echo -n '5-7.1' > /sys/bus/usb/drivers/usb/unbind
...
UEVENT[1197461594.450389]
remove@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1/5-7.1:1.0
UEVENT[1197461594.451166] remove@/class/usb_endpoint/usbdev5.15_ep00
(end)
(note: no remove@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1 line)

-> send libusb clear port power feature message
(no events, port power turned off)

-> send libusb set port power feature message
UEVENT[1197461490.598565] remove@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1
(note:  the remove@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1
event is deferred until port power on)
(note: the rest of the events are the same as in physical disconnect/connect)
UEVENT[1197461490.867005] add@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1
UEVENT[1197461490.867344] add@/class/usb_endpoint/usbdev5.15_ep00
UEVENT[1197461490.867689]
add@/devices/pci0000:00/0000:00:1d.7/usb5/5-7/5-7.1/5-7.1:1.0
....


Vlado

-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.