Skip to Content.
Sympa Menu

baslinux - Re: [BL] USB devices

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: Christof Lange <cce.zizkov AT volny.cz>
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] USB devices
  • Date: Wed, 3 Jan 2007 07:54:44

On 2 Jan 07 at 14:52, davidjmoberg AT gmail.com wrote:

David,

thank you for your detailed answer. It was very helpful for me
even - as you guessed - I did not understand everything.

>Here is a quick script that I put together:
>
>#!/bin/sh
>dmesg_command=dmesg
>exec mount /dev/$($dmesg_command | head -n $(($($dmesg_command | grep
>-n $1 | cut -f1 -d: | tail -n 1)+2)) | tail -n 1 | cut -f5 -d" ")$2 $3

>
>script_from_above "Cruzer Mini" 1 /mnt/cruzer

Now I understood that all those annoying messages filling the screen
are coming from the kernel and can be read with the dmesg command.
This is very useful. Even though I have not fully understood the
above script (due to parentheses, options and replacements) it seems
clear enough to me, that you extract the addresses scsi0, scsi1 etc.
from these messages.

Before further decrypting your script, I read again the kernel
messages while plugging in and out different USB memory sticks. And
came to the conclusion that this method will work only for the first
four devices plugged into.

For the first device the kernel announces scsi0, that can be
translated to /dev/sda1, the next device is registered as scsi1.
The fifth on, however, is interpreted as /dev/sde1. This is funny as
the device does not exist on my BL2 installation. But in reality it
is possible to mount it - from /dev/sda1. Unfortunately it is not
possible to find the place by simply counting and doing modulus 4,
because there are two USB slots and the new device can only be found
on an address that is not yet occupied... So the kernel messages
are interesting, but not sufficient.

BTW: Is there a way to prevent these messages to appear on the
screen? IMO it would be enough to read them through dmesg.

>3) Looking through /proc/scsi. This is not 100% reliable but does work most
>of the time.

...

>The above script uses dmesg. dmesg is not always reliable but should
>work 90% of the time. You can improve reliability of this method by
>using the klogd system and additional dmesg parameters to make sure
>that dmesg always has the information that this script needs. An
>alternate script could use /proc/scsi to check for devices, but that
>would be more complex and require that /proc be mounted. However, it
>could work where dmesg fails.

This seems to be similar to my last approach - I tried to open
/dev/sda1 ... /dev/sda4. I will have a look at /proc/scsi with
Midnight commander...

>
>If you were able to follow this entire message you deserve a reward. I
>undoubtedly did not write clearly enough for it to be understandable.
>Please ask for clarification if you did not understand any part of the
>above.

Most of the messages on the mailing list I do not understand -
mainly because I do not know what they are about. Your explanations
are quite helpful, thank you.

>P.S. Christof, is your computer's clock set correctly? My mail system
>says that I received this message at about 9 this morning but the
>message is dated 6 o'clock tonight. Could this be a timezone problem
>(GMT instead of local time, or me being halfway around the world from
>Czechoslovakia)?

I have no idea where you are located and do not quite understand the
problem. I am 1 hour form GMT. I shall send a mail to myself in order
to see whether the time is correct. But obviously it is you, who has
set the clock incorrectly, actually Czechoslovakia is not only 9
hours away, but 14 years - in the year 1993 Slovakia was separated
from Czech republic and Czechoslovakia ceased to exist.

Christof, 3th Jan 7:53 a.m.



________________________________________________________________

Ceskobratrska cirkev evangelicka - Betlemska kaple na Zizkove
Prokopova 4/216, 130 00 Praha 3, Czech Republic
Tel. (+420) 222 78 06 73 / 222 78 20 02 / 603 18 87 53
http://www.volny.cz/cce.zizkov





Archive powered by MHonArc 2.6.24.

Top of Page