Messages in this thread Patches in this message | | | Date | Tue, 15 Jun 2004 14:26:49 -0400 (EDT) | From | Byron Stanoszek <> | Subject | [PATCH] Make USB process hub events in correct order |
| |
This patch fixes the USB hub module to process events in the order that they are received. It fixes the case where multi-port devices have multiple hubs in them--while they are detected in the correct order, they are initialized in reverse. It is required for the Sealink 8-port USB->serial hubs to initialize with the port numbers in the correct order.
I don't think it breaks any existing functionality, but I won't send this to Linus yet till I know it doesn't break anything.
Patch below against 2.6.7-rc3.
--- linux/drivers/usb/core/hub.bak 2004-06-08 10:21:57.000000000 -0400 +++ linux/drivers/usb/core/hub.c 2004-06-08 10:59:34.000000000 -0400 @@ -260,7 +260,7 @@
/* Something happened, let khubd figure it out */ if (list_empty(&hub->event_list)) { - list_add(&hub->event_list, &hub_event_list); + list_add_tail(&hub->event_list, &hub_event_list); wake_up(&khubd_wait); }
An example without the patch (1-1.2.1 gets initialized before 1-1.1.1):
usb 1-1: new full speed USB device using address 2 hub 1-1:1.0: USB hub found hub 1-1:1.0: 4 ports detected usb 1-1.1: new full speed USB device using address 3 hub 1-1.1:1.0: USB hub found hub 1-1.1:1.0: 4 ports detected usb 1-1.2: new full speed USB device using address 4 hub 1-1.2:1.0: USB hub found hub 1-1.2:1.0: 4 ports detected usb 1-1.2.1: new full speed USB device using address 5 ftdi_sio 1-1.2.1:1.0: FTDI FT232BM Compatible converter detected usb 1-1.2.1: FTDI FT232BM Compatible converter now attached to ttyUSB0 (or usb/tts/0 for devfs) usb 1-1.2.2: new full speed USB device using address 6 ftdi_sio 1-1.2.2:1.0: FTDI FT232BM Compatible converter detected usb 1-1.2.2: FTDI FT232BM Compatible converter now attached to ttyUSB1 (or usb/tts/1 for devfs) usb 1-1.2.3: new full speed USB device using address 7 ftdi_sio 1-1.2.3:1.0: FTDI FT232BM Compatible converter detected usb 1-1.2.3: FTDI FT232BM Compatible converter now attached to ttyUSB2 (or usb/tts/2 for devfs) usb 1-1.2.4: new full speed USB device using address 8 ftdi_sio 1-1.2.4:1.0: FTDI FT232BM Compatible converter detected usb 1-1.2.4: FTDI FT232BM Compatible converter now attached to ttyUSB3 (or usb/tts/3 for devfs) usb 1-1.1.1: new full speed USB device using address 9 ftdi_sio 1-1.1.1:1.0: FTDI FT232BM Compatible converter detected usb 1-1.1.1: FTDI FT232BM Compatible converter now attached to ttyUSB4 (or usb/tts/4 for devfs) usb 1-1.1.2: new full speed USB device using address 10 ftdi_sio 1-1.1.2:1.0: FTDI FT232BM Compatible converter detected usb 1-1.1.2: FTDI FT232BM Compatible converter now attached to ttyUSB5 (or usb/tts/5 for devfs) usb 1-1.1.3: new full speed USB device using address 11 ftdi_sio 1-1.1.3:1.0: FTDI FT232BM Compatible converter detected usb 1-1.1.3: FTDI FT232BM Compatible converter now attached to ttyUSB6 (or usb/tts/6 for devfs) usb 1-1.1.4: new full speed USB device using address 12 ftdi_sio 1-1.1.4:1.0: FTDI FT232BM Compatible converter detected usb 1-1.1.4: FTDI FT232BM Compatible converter now attached to ttyUSB7 (or usb/tts/7 for devfs)
With the patch (the correct ordering):
usb 1-1: new full speed USB device using address 2 hub 1-1:1.0: USB hub found hub 1-1:1.0: 4 ports detected usb 1-1.1: new full speed USB device using address 3 hub 1-1.1:1.0: USB hub found hub 1-1.1:1.0: 4 ports detected usb 1-1.2: new full speed USB device using address 4 hub 1-1.2:1.0: USB hub found hub 1-1.2:1.0: 4 ports detected usb 1-1.1.1: new full speed USB device using address 5 ftdi_sio 1-1.1.1:1.0: FTDI FT232BM Compatible converter detected usb 1-1.1.1: FTDI FT232BM Compatible converter now attached to ttyUSB0 (or usb/tts/0 for devfs) usb 1-1.1.2: new full speed USB device using address 6 ftdi_sio 1-1.1.2:1.0: FTDI FT232BM Compatible converter detected usb 1-1.1.2: FTDI FT232BM Compatible converter now attached to ttyUSB1 (or usb/tts/1 for devfs) usb 1-1.1.3: new full speed USB device using address 7 ftdi_sio 1-1.1.3:1.0: FTDI FT232BM Compatible converter detected usb 1-1.1.3: FTDI FT232BM Compatible converter now attached to ttyUSB2 (or usb/tts/2 for devfs) usb 1-1.1.4: new full speed USB device using address 8 ftdi_sio 1-1.1.4:1.0: FTDI FT232BM Compatible converter detected usb 1-1.1.4: FTDI FT232BM Compatible converter now attached to ttyUSB3 (or usb/tts/3 for devfs) usb 1-1.2.1: new full speed USB device using address 9 ftdi_sio 1-1.2.1:1.0: FTDI FT232BM Compatible converter detected usb 1-1.2.1: FTDI FT232BM Compatible converter now attached to ttyUSB4 (or usb/tts/4 for devfs) usb 1-1.2.2: new full speed USB device using address 10 ftdi_sio 1-1.2.2:1.0: FTDI FT232BM Compatible converter detected usb 1-1.2.2: FTDI FT232BM Compatible converter now attached to ttyUSB5 (or usb/tts/5 for devfs) usb 1-1.2.3: new full speed USB device using address 11 ftdi_sio 1-1.2.3:1.0: FTDI FT232BM Compatible converter detected usb 1-1.2.3: FTDI FT232BM Compatible converter now attached to ttyUSB6 (or usb/tts/6 for devfs) usb 1-1.2.4: new full speed USB device using address 12 ftdi_sio 1-1.2.4:1.0: FTDI FT232BM Compatible converter detected usb 1-1.2.4: FTDI FT232BM Compatible converter now attached to ttyUSB7 (or usb/tts/7 for devfs)
-Byron
-- Byron Stanoszek Ph: (330) 644-3059 Systems Programmer Fax: (330) 644-8110 Commercial Timesharing Inc. Email: byron@comtime.com--- linux/drivers/usb/core/hub.bak 2004-06-08 10:21:57.000000000 -0400 +++ linux/drivers/usb/core/hub.c 2004-06-08 10:59:34.000000000 -0400 @@ -260,7 +260,7 @@ /* Something happened, let khubd figure it out */ if (list_empty(&hub->event_list)) { - list_add(&hub->event_list, &hub_event_list); + list_add_tail(&hub->event_list, &hub_event_list); wake_up(&khubd_wait); } | |