Results 1 to 6 of 6

Thread: linuxrc bug? - WL-500g not booting from usb drive with hub

  1. #1

    linuxrc bug? - WL-500g not booting from usb drive with hub

    Setup:
    I am trying to boot my router from a usb memory stick which is connected to a usb 1.1 4-port hub. Besides the stick, there are two usb printers and a soundcard connected to the hub, which is currently powered by an external power supply. For preparing the usb drive, I followed the instructions on Oleg's firmware page.

    Problem:
    When there are more than two devices connected to the hub, the router does not boot from the usb drive, but from internal flash, the usb drive is mounted as /tmp/harddisk, and an ftp server is started...

    I suspect that this is because of the two seconds delay in the linuxrc script that makes the router wait until the usb devices are created in the kernel. It looks like this is too slow when there is a hub with a lot of devices connected.

    To test this, I ran some parts of the linuxrc script from the commandline, pasting the whole text at once. I also inserted two 'date' commands to get an idea of the speed. Here is the code executed on the command line and it's output:

    Code:
    [admin@(none) root]$ date
    Sat Jan 14 18:31:36 MEZ 2006
    [admin@(none) root]$ insmod ide-mod && insmod ide-probe-mod && insmod ide-disk
    insmod: ide-mod.o: no module by that name found
    [admin@(none) root]$ insmod usbcore; insmod usb-ohci
    Using /lib/modules/2.4.20/kernel/drivers/usb/usbcore.o
    insmod: A module named usbcore already exists
    Using /lib/modules/2.4.20/kernel/drivers/usb/host/usb-ohci.o
    [admin@(none) root]$ insmod ehci-hcd && insmod usb-uhci && sleep 2s
    insmod: ehci-hcd.o: no module by that name found
    [admin@(none) root]$ insmod scsi_mod && insmod sd_mod && insmod usb-storage
    Using /lib/modules/2.4.20/kernel/drivers/scsi/scsi_mod.o
    Using /lib/modules/2.4.20/kernel/drivers/scsi/sd_mod.o
    Using /lib/modules/2.4.20/kernel/drivers/usb/storage/usb-storage.o
    [admin@(none) root]$ sleep 2s; date
    Sat Jan 14 18:31:39 MEZ 2006
    [admin@(none) root]$ mount -t ext3 -o ro "/dev/scsi/host0/bus0/target0/lun0/part1" /mnt || mount -t ext2 -o ro "/dev/scsi/host0/bus0/target0/lun0/part1" /mnt
    mount: Mounting /dev/scsi/host0/bus0/target0/lun0/part1 on /mnt failed: No such file or directory
    mount: Mounting /dev/scsi/host0/bus0/target0/lun0/part1 on /mnt failed: No such device
    And here are the corresponding syslog entries:

    Code:
    Jan 14 18:31:37 kernel: usb-ohci.c: USB OHCI at membase 0xb8004000, IRQ 2
    Jan 14 18:31:37 kernel: usb-ohci.c: usb-00:04.0, PCI device 14e4:4715
    Jan 14 18:31:37 kernel: usb.c: new USB bus registered, assigned bus number 1
    Jan 14 18:31:37 kernel: hub.c: USB hub found
    Jan 14 18:31:37 kernel: hub.c: 2 ports detected
    Jan 14 18:31:37 kernel: SCSI subsystem driver Revision: 1.00
    Jan 14 18:31:37 kernel: Initializing USB Mass Storage driver...
    Jan 14 18:31:37 kernel: usb.c: registered new driver usb-storage
    Jan 14 18:31:37 kernel: USB Mass Storage support registered.
    Jan 14 18:31:37 kernel: hub.c: new USB device 00:04.0-1, assigned address 2
    Jan 14 18:31:37 kernel: hub.c: USB hub found
    Jan 14 18:31:37 kernel: hub.c: 4 ports detected
    Jan 14 18:31:38 kernel: hub.c: new USB device 00:04.0-1.1, assigned address 3
    Jan 14 18:31:38 kernel: hub.c: USB hub found
    Jan 14 18:31:38 kernel: hub.c: 1 port detected
    Jan 14 18:31:39 kernel: hub.c: new USB device 00:04.0-1.2, assigned address 4
    Jan 14 18:31:39 kernel: usb.c: USB device 4 (vend/prod 0x3f0/0x1504) is not claimed by any active driver.
    Jan 14 18:31:39 kernel: hub.c: new USB device 00:04.0-1.3, assigned address 5
    Jan 14 18:31:39 kernel: usb.c: USB device 5 (vend/prod 0x67b/0x2305) is not claimed by any active driver.
    Jan 14 18:31:40 kernel: hub.c: new USB device 00:04.0-1.4, assigned address 6
    Jan 14 18:31:40 kernel: usb.c: USB device 6 (vend/prod 0x41e/0x3020) is not claimed by any active driver.
    Jan 14 18:31:40 USB audio: attached
    Jan 14 18:31:40 kernel: hub.c: new USB device 00:04.0-1.1.1, assigned address 7
    Jan 14 18:31:40 kernel: scsi0 : SCSI emulation for USB Mass Storage devices
    Jan 14 18:31:40 kernel:   Vendor: Prolific  Model: USB Flash Disk    Rev: PROL
    Jan 14 18:31:40 kernel:   Type:   Direct-Access                      ANSI SCSI revision: 02
    Jan 14 18:31:40 kernel: Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
    Jan 14 18:31:40 kernel: SCSI device sda: 256000 512-byte hdwr sectors (131 MB)
    Jan 14 18:31:40 kernel: sda: Write Protect is off
    Jan 14 18:31:40 kernel:  p1
    Jan 14 18:31:46 kernel: kjournald starting.  Commit interval 5 seconds
    Jan 14 18:31:46 kernel: EXT3 FS 2.4-0.9.19, 19 August 2002 on sd(8,1), internal journal
    Jan 14 18:31:46 kernel: EXT3-fs: mounted filesystem with ordered data mode.
    Jan 14 18:31:46 USB storage: ext3 fs mounted to /tmp/harddisk
    Jan 14 18:31:46 FTP server: daemon is started
    As you can see, the mount command is started at 18:31:39, but the scsi device is created at 18:31:40, so mount has a good reason to fail.

    When there are only two devices connected to the hub, the router boots from the usb drive. Also the commands extracted from linuxrc work nicely when the delay is increased to 4s.

    Question:
    Is there a way to increase the delay in the linuxrc script?

  2. #2
    Join Date
    Dec 2003
    Location
    Russian Federation
    Posts
    8,350
    Quote Originally Posted by daniel632
    Is there a way to increase the delay in the linuxrc script?
    The only way at the moment is recompiling a firmware. Yet another way is to replace hub with another one.

  3. #3
    Edit: It really seems to be a timing problem. If I wait to plug the second reader until booted then it seems to work.
    ---------------------------------------------------------------------------------------------------------------

    Could it be that there is a kernel limit of two usb devices?
    I've played around with 2 different hub's, 2 usbserial readers and 2 "disks" but can't get more than 2 devices working at the same time no matter how they are connected.

    Ex. 1 disk & 1 reader on a hub is OK, but with one more reader (on the hub or in the 2nd w500 port), only one reader dev is created.
    Part of dmesg output below.

    Without the disk, two readers can be connected direct to the w500 usb ports or via a hub in any combination.

    If there is a kernel limit, where can I find it?

    Thanks

    PHP Code:
    ehci_hcd 01:03.2USB 2.0 enabledEHCI 1.00driver 2003-Dec-29/2.4
    hub
    .cUSB hub found
    hub
    .c4 ports detected
    usb
    .cregistered new driver usblp
    printer
    .cv0.13USB Printer Device Class driver
    SCSI subsystem driver Revision
    1.00
    hub
    .cconnect-debounce failedport 1 disabled
    Initializing USB Mass Storage driver
    ...
    usb.cregistered new driver usb-storage
    USB Mass Storage support registered
    .
    hub.c: new USB device 01:03.2-2assigned address 2
    hub
    .cUSB hub found
    hub
    .c4 ports detected
    usb
    .cregistered new driver serial
    usbserial
    .cUSB Serial support registered for Generic
    usbserial
    .cUSB Serial Driver core v1.4
    usbserial
    .cUSB Serial support registered for FTDI SIO
    usbserial
    .cUSB Serial support registered for FTDI 8U232AM Compatible
    usbserial
    .cUSB Serial support registered for FTDI FT232BM Compatible
    usbserial
    .cUSB Serial support registered for USB-UIRT Infrared Receiver/Transmitter
    usbserial
    .cUSB Serial support registered for Home-Electronics TIRA-1 IR Transceiver
    ftdi_sio
    .cv1.3.5:USB FTDI Serial Converters Driver
    hub
    .c: new USB device 01:03.2-2.2assigned address 3
    scsi0 
    SCSI emulation for USB Mass Storage devices
      Vendor
    SanDisk   ModelCruzer            Rev8.01
      Type
    :   Direct-Access                      ANSI SCSI revision02
      Vendor
    SanDisk   ModelCruzer            Rev8.01
      Type
    :   CD-ROM                             ANSI SCSI revision02
    Attached scsi removable disk sda at scsi0
    channel 0id 0lun 0
    SCSI device sda
    3907711 512-byte hdwr sectors (2001 MB)
    sdaWrite Protect is off
    Partition check
    :
     /
    dev/scsi/host0/bus0/target0/lun0p1
    WARNING
    USB Mass Storage data integrity not assured
    USB Mass Storage device found at 3
    hub
    .c: new USB device 01:03.2-2.3assigned address 4
    usb
    .cnot enough configurations
    usb
    .cunable to get device 4 configuration (error=-22)
    hub.c: new USB device 01:03.2-2.3assigned address 5
    usb
    .cnot enough configurations
    usb
    .cunable to get device 5 configuration (error=-22)
    hub.c: new USB device 01:03.0-1assigned address 2
    usbserial
    .cFTDI FT232BM Compatible converter detected
    usbserial
    .cFTDI FT232BM Compatible converter now attached to ttyUSB0 (or usb/tts/for devfs)
    kjournald starting.  Commit interval 5 seconds
    EXT3
    -fs warningmaximal mount count reachedrunning e2fsck is recommended
    EXT3 FS 2.4
    -0.9.1919 August 2002 on sd(8,1), internal journal
    EXT3
    -fsrecovery complete.
    EXT3-fsmounted filesystem with ordered data mode
    Last edited by cmuarg; 20-11-2008 at 18:09. Reason: the problem is not a limit of two usb devices

  4. #4
    After some trial and error, it seems like the following introduced delay fix the problem (don’t ask me why):

    Firmware 1.9.2.7-10, file src/linux/linux/drivers/usb/usb.c

    In the function usb_new_device()

    Code:
    ……
    err = usb_get_device_descriptor(dev);
    if (err < (signed)sizeof(dev->descriptor)) {
            if (err < 0)
                err("unable to get device descriptor (error=%d)", err);
            else
                err("USB device descriptor short read (expected %Zi, got %i)",
                    sizeof(dev->descriptor), err);
    
            clear_bit(dev->devnum, &dev->bus->devmap.devicemap);
            dev->devnum = -1;
            return 1;
    }
    
    // added delay
    #if 1  // wait for data
    {
            int wcnt;
            for(wcnt=0; wcnt<20 && dev->descriptor.bNumConfigurations==0; wcnt++)
            {
                wait_ms(50);
                // err("ewait(%d)=%d", wcnt+1, dev->descriptor.bNumConfigurations);
            }
     }
    #endif
    …….

  5. #5
    You have to set up and build the kernel as decribed in http://oleg.wl500g.info.

  6. #6
    It could be that the delay help to wait the usb link establishement.
    In that case I would exepect the delay should be added before the usb_get_device_descriptor() function.
    It could be that the enumeration is started 3 times in loop, and the delay added after the usb_get_device_descriptor() help for the next or last loop.

Similar Threads

  1. Please help... USB HDD doesn't work
    By jirina42 in forum WL-500g Q&A
    Replies: 6
    Last Post: 05-01-2006, 20:04
  2. Kann nicht schreiben per Samba!?!
    By Smart71 in forum German Discussion - Deutsch (DE)
    Replies: 3
    Last Post: 31-12-2005, 09:33
  3. USB Hard Drive
    By jirina42 in forum WL-500g Q&A
    Replies: 1
    Last Post: 15-12-2005, 16:36
  4. ftp and usb HUB
    By alfred in forum WL-500g Q&A
    Replies: 0
    Last Post: 11-11-2005, 04:59
  5. External Hard Drive + USB Hub Question!
    By akula in forum WL-500g Q&A
    Replies: 6
    Last Post: 16-04-2005, 22:23

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •