Scanning for USB devices

Started by
6 comments, last by Raduprv 18 years, 10 months ago
I am using Mepis for my laptop, and I have a problem with some USB devices such as cameras or memory sticks/mp3 players. Sometimes, when I hot plug them, they are detected, sometimes not. And if they are not detected I have to reboot, then they are detected properly. So I was wondering, is there such a command to rescan the USB ports for new devices? If so, I'll put it in cron tab maybe. [Edited by - Raduprv on May 29, 2005 7:48:08 PM]
Advertisement
Hey
I am not sure how you use your memsticks but I always do:

mount -t vfat /dev/sda1 /mount/memstick

It worked without any problems on slack and fc2.

Give it a try

FimDan

Hmm...
Tried that and I got: special device /dev/sda1 does not exist.
But when it mounts my device by itself (when it detects it at start up) it mounts it on /mnt/sda1
So this is strange...
BTW, my distro is Mepis
Thing called udev creates the device sda1 automagically when kernel detects an usb device. Actually it goes like this: when you plug your usb stick in, the kernel calls little script called /sbin/hotplug. This script in turn calls progs linked in /etc/hotplug.d. There you'll find link to udev. When udev is called it scans the sysfs pseudo filesystem (similar to proc) for new devices and creates the devices according to rules found in /etc/udev/.

Now at some point there is a glitch (as you might have noticed :) )..

When your usb stick is not being recognised do this: run dmesg | tail -n 10 in a console. It prints last 10 lines your kernel has printed. Now plug your usb stick in and run the previous command again. Compare these two outputs. Do you see anything about usb mass storage? If you do then kernel is propably working correctly (unless you see an error message instead of just normal notice).

If the kernel is a ok, then it is probably some problem in the hotplug scripts or udev rules. Try to find for a similar bug in Mepis mailing lists or install updates for the hotplug/udev scripts.
Hmm, apparently the kernel does recognize it:
Quote:
root@4[mnt]# dmesg|tail -n 10
FAT: Directory bread(block 2017) failed
scsi0 (0:0): rejecting I/O to dead device
FAT: Directory bread(block 2018) failed
scsi0 (0:0): rejecting I/O to dead device
FAT: Directory bread(block 2019) failed
usb 1-3: USB disconnect, address 6
usb 1-3: new high speed USB device using ehci_hcd and address 7
scsi3 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 7
usb-storage: waiting for device to settle before scanning
root@4[mnt]# dmesg|tail -n 10
Type: Direct-Access ANSI SCSI revision: 04
SCSI device sdc: 1014784 512-byte hdwr sectors (520 MB)
sdc: assuming Write Enabled
sdc: assuming drive cache: write through
SCSI device sdc: 1014784 512-byte hdwr sectors (520 MB)
sdc: assuming Write Enabled
sdc: assuming drive cache: write through
sdc: sdc1
Attached scsi removable disk sdc at scsi3, channel 0, id 0, lun 0
usb-storage: device scan complete


So... now what? :)
Ok, I tried mount /dev/sdc1 /mnt/sdc1
And it worked :)
Well, at least I can do it manually :)
Thanks!
You could write a hotplug script to do it automaticly as soon as a usb mass storage device is detected.
I don't really feel like doing that (I am not very familiar with the Linux internals).

This topic is closed to new replies.

Advertisement