LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 06-10-2004, 08:30 AM   #1
detly
Member
 
Registered: Nov 2003
Distribution: Debian Sarge/Etch
Posts: 54

Rep: Reputation: 15
"Turning off" USB memory stick before unplugging/disconnecting


Dist: RedHat 9; Kernel 2.4.20-8

After a few initial problems, I can now mount and use my Transcend Jetflash USB memory stick under Linux. My problem now, however, lies in disconnecting it. Unmounting goes fine, and causes no errors or problems. On other systems, though (Windows 98+, Mac OS9-X), after the drive has been unmounted (or whatever they call it) the little red LED goes off to indicate that it's no longer in use. Under Linux, though, this doesn't happen.

If I simply unplug it (after unmounting it), I get the following message:

Code:
sda : READ CAPACITY failed.
sda : status = 1, message = 00, host = 0, driver = 08
Info fld=0xa00 (nonstd), Current sd00:00: sense key Not Ready
sda : block size assumed to be 512 bytes, disk size 1GB.
 I/O error: dev 08:00, sector 0
 unable to read partition table
The latest from dmesg is:

Code:
usb.c: USB disconnect on device 00:04.2-2 address 2
Device not ready.  Make sure there is a disc in the drive.
sda : READ CAPACITY etc, as above
From /var/log/messages:

Code:
Jun 10 20:31:15 localhost kernel: usb.c: USB disconnect on device 00:04.2-2 address 2
Jun 10 20:31:16 localhost kernel: Device not ready.  Make sure there is a disc in the drive.
Jun 10 20:31:16 localhost kernel: sda : READ CAPACITY failed.
Jun 10 20:31:16 localhost kernel: sda : status = 1, message = 00, host = 0, driver = 08 
Jun 10 20:31:16 localhost kernel: Info fld=0xa00 (nonstd), Current sd00:00: sense key Not Ready
Jun 10 20:31:16 localhost kernel: sda : block size assumed to be 512 bytes, disk size 1GB.  
Jun 10 20:31:16 localhost kernel:  sda: I/O error: dev 08:00, sector 0
Jun 10 20:31:16 localhost kernel:  I/O error: dev 08:00, sector 0
Jun 10 20:31:16 localhost kernel:  unable to read partition table
Jun 10 20:31:16 localhost devlabel: devlabel service started/restarted
I have discovered, by chance, that if I do:
modprobe -r usb-uhci
then the light goes off and I don't get any errors. This doesn't really strike me as a good solution since I can't do this as a non-root user (apart from which it seems like a bit of a hack).

Now despite all of this, there are no errors or problems with the memory stick afterwards. But I'm sure there's a standard way of doing such a thing.

Last edited by detly; 06-11-2004 at 12:15 AM.
 
Old 06-10-2004, 09:15 AM   #2
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
modprobe -r usb-uhci

removes the usb-uhci module from your kernel. I don't think this is needed....simply umounting the stick should do, because that's what you do with floppies too - mount it, use it, umount it, and take it off. the led burning indicates, I think, that the system knows about the stick and the stick knows it's plugged to something...I think that when you plug it in in windows, it gets "mounted" automatically - when you choose to take the device off, it gets "umounted" and at the same time windows system just thinks there is no device in the usb anymore. these are my thoughts only, but as far as I know, it's no harm to plug it out after umounting even if you get errors...

the errors occur, I think, because the kernel module doesn't know when you're going to remove the stick and just tells you that you have done so and it didn't know of it beforehand (or something like this...hey, it doesn't say 'you did this one wrong' or anything heh)

modprobe -r:ing the usb-uhci removes the kernel module so after that your kernel doesn't know about your stick (or actually, it can't handle it because it doesn't know what to do without the module) - but it doesn't mean that you have to do it. I've used my stick happily by mounting and umounting it, and haven't cared about the errors. and everything has worked. I took the burning led as a signal that everything is ok and the stick is recognized...
 
Old 06-11-2004, 12:14 AM   #3
detly
Member
 
Registered: Nov 2003
Distribution: Debian Sarge/Etch
Posts: 54

Original Poster
Rep: Reputation: 15
Well, seeing as there aren't any real problems caused, I'm probably just being paranoid...

Thank you
 
Old 03-15-2005, 12:34 PM   #4
axlmad
LQ Newbie
 
Registered: Mar 2005
Posts: 1

Rep: Reputation: 0
Turn off led!

As USB sticks are seen by the OS as SCSI drives you may try this command:
eject -s <stick device or stick mount point>
This worked for me to turn off the led of a 256 Mb Transcend JetFlash, on Fedora Core 2, kernel 2.6.8, but yet I had other problems that I wanted to
solve regarding mounting/unmounting the stick (more precisely after an unmount/eject operation the system couldn't detect the stick anymore). In the mean time I updated to kernel 2.6.10 and things are better, yet I donno the effect of eject on the uhci module neither I tested that command again. What I'm trying to tell you is 'use it with caution and at your own risk'!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't "Safely Remove" usb stick: KDE, SUSE 10.0 m29389 Suse/Novell 8 11-15-2005 11:35 PM
What "kernel opts" allow PC to power down with "turning energy off"? kornerr Linux - General 1 03-10-2005 12:07 PM
USB stick, "losing space" - filesystem inconsistensies? iskrem Linux - Hardware 1 11-26-2004 06:01 PM
lost writing ability on usb-stick / not possible with protocol "drives" - how to fix? ungua Suse/Novell 3 11-24-2004 08:11 PM
how to enable memory stick "autoplay"? amaru Linux - Hardware 1 10-25-2003 01:47 PM


All times are GMT -5. The time now is 11:39 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration