this is how i mount my usb drive in 9.2
i edited my /etc/hotplug/usb.usermap to include the two lines:
# Integral 128mb USB Flash Drive
usbdrive-script 0x0003 0x0d7d 0x1420 0x0000 0x0000
0x00 0x00 0x00 0x00 0x00
0x00 0x00000000
the 'usbdrive-script' is a script that i wrote to do mounting and stuff, it is
placed in /etc/hotplug/usb/
the '0x0d7d' and 0x1420' 3rd and 4th entries on the second line respectively,
are the usb vendore and product code, even when linux has no driver for a usb
itme it will know the vendor code and the product code since this is passed
on as part of the device detection process and is the same for all usb
devices, you will need to find them for your device, try usbview and look for
'vendorid' and 'productid'
my 'usbdrive-script' reads:
#!/bin/bash
#
#usbdrive-script
#
sleep 5s
#
echo /home/bascule/scripts/unmountusbdrive > $REMOVER
chmod u+x $REMOVER
#
/home/bascule/scripts/usbdrive
i use the sleep command to allow the device to be fully setup by the drivers,
the $REMOVER is a variable that is created for each hotplug event, it
references what should happen when the device is removed, in the past one
could also use the variable $DEVICE to refer to the mount point but since i
went to lm9.2 this no longer seemed to work, at least for usb storage
devices.
the script 'usbdrive' calls a more complicated script that endeavours to
ascertain the device file for the usbdriev so that it may be mounted and
unmounted, this more complicated script relies on my usbdrive always being
identifed in linux as "USB DISK Pro" and that whenever it is plugged in, it
is treated as a scsi device and appears as an entry in /proc/scsi/scsi
here is 'usbdrive':
#!/bin/bash
#
#usbdrive
#
devicename="USB DISK Pro"
#
. /home/bascule/scripts/finddevice
#
umount $devicefile
umount $symdev
#
mount -o uid=500,gid=500, $devicefile /mnt/usbdrive && play
/common_stuff/wavs/misc/halawake.wav
in this script /mnt/usbdrive is a mountpoint of my choice, the line
. /home/bascule/scripts/finddevice runs the finddevice script and uses the
variables it defines - $devicefile and $symdev, the '&&' bit just plays a wav
file if there is a succesfull mount :)
here is the meat, the finddevice script:
#!/bin/bash
#finddevice
#
#first we find the line from /proc/scsi/scsi with
#the device name in
#
#'devicename' should be set by calling script
#
#devicename="USB DISK Pro"
line=$(cat /proc/scsi/scsi |grep -n "$devicename"|gawk '{print $1}'|sed
's/://g' |head -1)
#
#next we refer to the preceding line that has the host info on
#
newline=$(( $line -1 ))
#
#next we parse 'newline' for host and bus info
host=host$(head -$newline /proc/scsi/scsi |tail -1|gawk '{print $2}'|sed
's/scsi//')
#
bus=bus$(( $(head -$newline /proc/scsi/scsi |tail -1|gawk '{print $4}') +0 ))
#
target=target$(( $(head -$newline /proc/scsi/scsi |tail -1|gawk '{print $6}')
+0 ))
#
lun=lun$(( $(head -$newline /proc/scsi/scsi |tail -1|gawk '{print $8}') +0 ))
#
#echo host=$host
#echo bus=$bus
#echo target=$target
#echo lun=$lun
#
#now we make an assumption concerning this device
#we assume that it has one partition and that is numbered 1
part=part1
#if this assumption should ever fail then
#parsing the directory listing of /dev/scsi/$host/$bus/$target/$lun
#would be necessary
devicefile=/dev/scsi/$host/$bus/$target/$lun/$part
echo devicefile=/dev/scsi/$host/$bus/$target/$lun/$part
shortdev=scsi/$host/$bus/$target/$lun/$part
symdev=$(find /dev -lname $shortdev)
there's an echo in the last lines for using on the command line while testing,
the variable $symdev should be the symlink under the /dev tree that links to
the full /dev/scsi/.....device file
for completeness my 'unmountusbdrive' script is:
#!/bin/bash
#
#unmountusbdrive
#
umount /mnt/usbdrive && play /common_stuff/wavs/misc/halsmind.wav
note that above is used the mount command with the options:
-o uid=500,gid=500
my user has 500 as uid and gid, ymv
this results in every plugin of my pen drive mounting in the same place as my
normal user, playing a wav when mounted and also when unmounted, note that i
always issue a manual 'sync' on the command line before unplugging, and watch
the little led on the device stop falshing before unplugging
i use lm9.2 and thus devfs, i'm told that using udev will make all this
redundant since there will then be a built in way to refer to a device in way
that will not change between boots and thus specify mount point etc in a
better way
anyway, maybe this will be of use?
bascule
On Monday 06 Sep 2004 6:57 pm, Matt Smith wrote:
> manually (this is very quick in Rox-Filer). I have tried creating a
> separate mount point for the drive and adding a new line in fstab but when
> I plug the drive in Mandrake just creates '/mnt/removable' preventing me
> from mounting the drive at my mount point.
> Does anyone have any suggestions as to how I could improve the situation
> with the drive?
> Cheers,
> Matt.
--
++?????++ Out of Cheese Error. Redo From Start.
(Interesting Times)
____________________________________________________
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com
____________________________________________________