Google
  Web www.spinics.net

hub port power control vs. physical disconnect/connect

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


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
_______________________________________________
linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

[Home]     [Video for Linux]     [Photo]     [Yosemite Forum]     [Yosemite Photos]    [Video Projectors]     [PDAs]     [Hacking TiVo]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]     [Big List of Linux Books]     [Free Dating]

  Powered by Linux