USB thumb drive

bridged with qnx.qnx4
Post Reply
Jeffrey Adler

USB thumb drive

Post by Jeffrey Adler » Sat Jun 16, 2007 5:13 pm

Hello all-

I have been trying to get a USB thumb drive to work under QNX-4.

I do the following:

io-usb
Fsys.umass
mount -P /dev/hd1
Fatfsys

All works fine, I can access the drive as /dos/c

Now I want to remove the thing. I have tried several variations, such as:

slay Fatfsys
umount /dev/hd1 (umount /dev/hd1t6 doesn't work at all)

slay Fsys.umass
(this tends to lock up the computer)

I can't seem to find the right combination that will let me remove the thumb
drive, reinsert it again later, and have it work OK.

Any suggestions???

Thanks,

Jeff.

maschoen

RE: USB thumb drive

Post by maschoen » Sun Jun 17, 2007 5:50 pm

After you slay Fatfsy try "umount /dev/hd1" and then
"rm /dev/hd1".

Jeffrey Adler

Re: USB thumb drive

Post by Jeffrey Adler » Mon Jun 18, 2007 1:08 pm

"maschoen" <maschoen@pobox-dot-com.no-spam.invalid> wrote in message
news:f53s9t$qn7$1@inn.qnx.com...
After you slay Fatfsy try "umount /dev/hd1" and then
"rm /dev/hd1".
Can you explain WHY this is the right thing to do? It just doesn't seem
"normal".

Thanks

Ryan J. Allen

Re: USB thumb drive

Post by Ryan J. Allen » Mon Jun 18, 2007 1:21 pm

On 18/06/2007 9:08 AM, Jeffrey Adler wrote:
Can you explain WHY this is the right thing to do? It just doesn't seem
"normal".
Fsys.umass doesn't support plug-and-play. It's a known issue and is
listed in the release notes:
http://www.qnx.com/developers/articles/rel_1637_1.html

--
Ryan J. Allen
QNX Software Systems

Subcommander

Re: USB thumb drive

Post by Subcommander » Fri Jun 29, 2007 9:49 pm

Perhaps my response is a little old, but I have a little script that
we use at work. We mount thumb drives as dos file systems for data
backup.

use mt.t to mount the thing
use mt.t -u to unmount it. (or umt.t if you link it to mt.t)

the -v option gives you verbosineity.

It will run io-usb if it is not already running,
It will run Fatfsys if it is not already running
It will autodetect upto 1 partition on the drive
It mounts the drive or the first partition as /dos/usb

I created a link to the same script called umt.t. The script detects
this and will un mount instead, or use the '-u' option.

NC-17 WARNING!!!!!

This is my first script and probably REALLY sucks!!!!

Use at your own RISK.

Also, if you know a better way, I am happy to learn.

here is the source

#! /bin/sh
#ifdef __USAGE
#%C [options]
#
#This script mounts a thumb drive as /dos/usb.
#
#Valid DOS partition types are 1, 4, 5, 6, 11, 12, 14, 15
#Partitions are searched for based on type in that order.
#If a drive has multiple partitions, only the first
#partition will be mounted.
#
#If the drive has no partitions the script will attempt to
#mount the raw device as a DOS drive...again as /dos/usb
#
#If the /bin/io-usb and /bin/Fatfsys processes are not
#already running, it will run them for you.
#
#
#Options:
# -u : umount thumb drive and clean up the drivers
# -v : verbose
#
#endif


#------------------------------------------------------------------
print_usage(){
echo "mt.t [options]"
echo
echo "Options:"
echo " -u : unmount thumb drive"
echo " -v : verbose"
exit 0
}
#------------------------------------------------------------------
unmount_clean(){
if test $verbose; then
printf "Unmount existing drive and stopping
drivers...\n"

printf "> umount /dos/usb: \n"
umount /dos/usb
printf "> umount /dev/hd_usb0: \n"
umount /dev/hd_usb0
printf "> slay -fQ Fsys.umass: \n"
slay -f Fsys.umass
printf "> rm /dev/hd_usb*: \n"
/bin/rm -v /dev/hd_usb*
echo
else
umount /dos/usb 2> /dev/null
umount /dev/hd_usb0 2> /dev/null
slay -fQ Fsys.umass 2> /dev/null
/bin/rm /dev/hd_usb* 2> /dev/null
fi
}
#------------------------------------------------------------------
mount_drive(){
if test $umount; then
if test $verbose; then
printf "OKAY TO REMOVE THUMB DRIVE.\n"
fi
exit 0
fi

########################################################33
# run the Fsys.umass drivers
########################################################33
if test $verbose; then
printf "> Fsys.umass fsys -n0=hd_usb: \n"
Fsys.umass fsys -n0=hd_usb
else
Fsys.umass fsys -n0=hd_usb 2> /dev/null
fi

sleep 1

########################################################33
# find the partitions
########################################################33
for tt in t1 t4 t5 t6 t11 t12 t14 t15
do
part=none;
fdisk /dev/hd_usb0 query $tt > junk
read myline < junk
if test $myline -gt 0
then
part=$tt
break;
fi
done

########################################################33
# mount the partitions
########################################################33
if test $verbose; then
if test $part = "none"
then
mount -t dos /dev/hd_usb0 /dos/usb
echo
printf "USB MOUNTED AS /dos/usb\n" $part
else
mount -p /dev/hd_usb0
mount -t dos /dev/hd_usb0$part /dos/usb
echo
printf "USB PARTITION TYPE(%s) MOUNTED AS
/dos/usb\n" $part
fi
else
if test $part = "none"
then
mount -t dos /dev/hd_usb0 /dos/usb 2> /dev/null
else
mount -p /dev/hd_usb0
mount -t dos /dev/hd_usb0$part /dos/usb 2> /dev/null
fi
fi
}
#------------------------------------------------------------------

me=${0##*/}

###########################################################3333
#
# CHECK TO MAKE SURE THE io-usb IS RUNNING
#
# io-usb is the QNX driver for the usb ports
#
###########################################################3333
ps | grep 'io-usb' | wc -l > junk
read lines < junk
if test $lines -eq 1
then
echo Starting io-usb...
/bin/io-usb &
sleep 4
fi

###########################################################3333
#
# CHECK TO MAKE SURE THE DOSFSYS IS !!!! NOT !!! RUNNING
#
# IF DOSFSYS IS RUNNING IT MUST BE STOPPED
#
###########################################################3333
ps | grep Dosfsys | wc -l > junk
read lines < junk

if test $lines -gt 1
then
echo "We Found Dosfsys Running, Dosfsys is OLD"
echo "slay dosfsys (Dosfsys -x), and try again."
exit 0;
fi

###########################################################3333
#
# CHECK TO MAKE SURE THE FATFSYS IS RUNNING
#
# FATFSYS IS THE DRIVER FOR THE DOS/WIN FAT32 FILESYSTEM
#
###########################################################3333
ps | grep Fatfsys | wc -l > junk
read lines < junk

if test $lines -eq 1
then
echo Starting Fatfsys...
/bin/Fatfsys &
sleep 4
fi

while getopts vu opt $*
do
case $opt in
v) verbose="yes";;
u) umount="yes";;
esac
done

case $me in
umt.t) umount="yes";;
esac

unmount_clean
mount_drive
exit 0
[/code]

Post Reply

Return to “qnx.qnx4”