usb-drives and device mapping - Embedded

This is a discussion on usb-drives and device mapping - Embedded ; Hello all, I have an embedded Linux system with 2.4.21 kernel running on a StrongARM SA-1110 CPU. The System has an USB-Host on which I use an usb memory stick. Normaly I can mount the stick on the device /dev/sda1. ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: usb-drives and device mapping

  1. usb-drives and device mapping

    Hello all,

    I have an embedded Linux system with 2.4.21 kernel running on a
    StrongARM SA-1110 CPU. The System has an USB-Host on which I use an usb
    memory stick. Normaly I can mount the stick on the device /dev/sda1.
    but if I take another usbstick, then this one is mapped to /dev/sdb. In
    /proc/scsi/ there are then the directories usb-storage-0,
    usb-storage-1,...
    the USB subsystem and the usb-storage is compiled into the kernel. How
    can I tell the kernel to remove the entries in /proc/scsi/ when I
    unplug the USB memory stick. Unfortunatly I can't compile my own kernel
    to include the usb-storge driver as module, because the manufactor of
    this device does not allow to modify the systemimage with costum
    kernels /modules.

    The system I'm talking about is found on the following URL
    http://www.icpdas.com/products/PAC/l...troduction.htm

    thanks for any help and hints
    Mike Lawson


  2. Re: usb-drives and device mapping

    Hi Mike,
    > I have an embedded Linux system with 2.4.21 kernel running on a
    > StrongARM SA-1110 CPU. The System has an USB-Host on which I use an usb
    > memory stick. Normaly I can mount the stick on the device /dev/sda1.
    > but if I take another usbstick, then this one is mapped to /dev/sdb. In
    > /proc/scsi/ there are then the directories usb-storage-0,
    > usb-storage-1,...
    > the USB subsystem and the usb-storage is compiled into the kernel. How
    > can I tell the kernel to remove the entries in /proc/scsi/ when I
    > unplug the USB memory stick.

    I don't think you can tell it to remove those. the usb-storage driver
    tries to remember devices so if you remove and re-insert them, they will
    re-appear in the same place.

    Removing the usb-storage module, or using a 2.6.x kernel would alleviate
    this problem, but you've said you aren't able to do either.

    regards,


    --
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
    | Damion de Soto --------------------------------------------------
    | Software Engineer email: Damion_deSoto@au.securecomputing.com
    | Secure Computing Corporation web: http://www.securecomputing.com
    | fax: +61 7 3891 3630 ph: +61 7 3435 2809
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
    ---- Free Embedded Linux Distro at http://www.snapgear.org ----

  3. Re: usb-drives and device mapping

    Panther (golum@wolke7.net) wrote at Tuesday 10. October 2006 11:06 in
    comp.os.linux.embedded:

    > Hello all,
    >
    > I have an embedded Linux system with 2.4.21 kernel running on a
    > StrongARM SA-1110 CPU. The System has an USB-Host on which I use an usb
    > memory stick. Normaly I can mount the stick on the device /dev/sda1.
    > but if I take another usbstick, then this one is mapped to /dev/sdb. In
    > /proc/scsi/ there are then the directories usb-storage-0,
    > usb-storage-1,...
    > the USB subsystem and the usb-storage is compiled into the kernel. How
    > can I tell the kernel to remove the entries in /proc/scsi/ when I
    > unplug the USB memory stick. Unfortunatly I can't compile my own kernel
    > to include the usb-storge driver as module, because the manufactor of
    > this device does not allow to modify the systemimage with costum
    > kernels /modules.
    >
    > The system I'm talking about is found on the following URL
    > http://www.icpdas.com/products/PAC/l...troduction.htm
    >
    > thanks for any help and hints
    > Mike Lawson


    Hi Mike,

    I don't know how to achieve this but can't you automatically detect as what
    device this stick appers to your system?
    I have done this by scanning /etc/fstab for a HOTPLUG entry:
    chat name[50] = "", mntpoint[50] = "";
    FILE * fstab = fopen("/etc/fstab", "r");
    if (! fstab)
    { perror("open fstab");
    goto error;
    }
    for(;
    { char line[200]
    if (! fgets(line, sizeof(line)-1, fstab))
    { perror("read fstab");
    fclose(fstab);
    goto error;
    }
    if (strstr(line, "#HOTPLUG"))
    { strcpy(name, strtok(line, " \t\n"));
    strcpy(mntpoint, strtok(0, " \t\n"));
    break;
    }
    }
    fclose(fstab);
    cout << "fstab: name=<" << name << "> mnt=<" << mntpoint << ">" << endl;
    if (strlen(name) == 0 || strlen(mntpoint) == 0)
    { cout << "No USB stick" << endl;
    goto error;
    }

    rc = mount(name, mntpoint, "vfat", 0xc0ed << 16 | MS_RDONLY, "");
    if (rc)
    { perror("UsbStick: mount");
    return EXIT_FAILURE;
    }

    --
    Reinhardt Behm, Bodenheim, Germany, reinhardt.behm@t-online.de


+ Reply to Thread