usb-drives and device mapping

Oct 10, 2006 2 Replies

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

formatting link



thanks for any help and hints Mike Lawson



Hi Mike,

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 ----

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

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

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required