View Single Post
  #3   (View Single Post)  
Old 4th January 2013
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,129
Default

It looks like you have to write a "/etc/rc.d" script for automatically mounting that device. An easier method would be a cron job which runs at "@reboot" time.

I don't know whether an interactive script would be acceptable .

Here is a beginning:
Code:
#!/bin/sh

# --- interactive script to run 'usbconfig add_quirk' before mounting

ID=""

# --- command 
#CMD="usbconfig -d $ID add_quirk UQ_OPEN_CLEARSTALL
CMD='usbconfig -d $ID dump_info'

# --- show all USB devices
echo USB devices ----
usbconfig

# prompt for unit and address
printf "\n\nPlease enter ugen nr: "
read ID

if [ ! "x$ID" == "x" ] ; then
   eval $CMD
else
  printf "\nSorry no ugen nr entered!"
  exit 1
fi

echo USB da* devices ----------
ls -l /dev/da*

echo camcontrol device list ---------
camcontrol devlist 

# --- for mount command
TYPE=msdosfs
OPTION=ro
MNT=/mnt
DEVICE=/dev/da2
SLICE=s1

echo mount -o ${OPTION} -t ${TYPE} ${DEVICE}${SLICE} $MNT
# mount -o ${OPTION} -t ${TYPE} ${DEVICE}${SLICE} $MNT
The output when running:
Code:
# ./usb_quirk_mnt
USB devices ----
ugen0.1: <EHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE
ugen1.1: <EHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE
ugen0.2: <product 0x0020 vendor 0x8087> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE
ugen1.2: <product 0x0020 vendor 0x8087> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE
ugen1.3: <SE USB Device ServerEngines> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen1.4: <DataTraveler G3 Kingston> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen1.5: <USB Embedded Hub Prolific Technology Inc.> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE
ugen1.6: <USB Mass Storage Device Prolific Technology Inc.> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen0.3: <Storage Media Sony> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON


Please enter ugen nr: 0.3
ugen0.3: <Storage Media Sony> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON

USB da* devices ----------
crw-r-----  1 root  operator    0, 117 Jan  4 04:57 /dev/da0
crw-r-----  1 root  operator    0, 118 Jan  4 04:57 /dev/da0s1
crw-r-----  1 root  operator    0, 120 Jan  4 04:57 /dev/da0s1a
crw-r-----  1 root  operator    0, 121 Jan  4 04:57 /dev/da0s1b
crw-r-----  1 root  operator    0, 119 Jan  4 04:57 /dev/da0s2
crw-r-----  1 root  operator    0, 122 Jan  4 04:57 /dev/da0s2a
crw-r-----  1 root  operator    0, 123 Jan  4 04:57 /dev/da0s2b
crw-r-----  1 root  operator    0, 115 Jan  4 04:57 /dev/da0s2d
crw-r-----  1 root  operator    0, 124 Jan  4 04:57 /dev/da0s2e
crw-r-----  1 root  operator    0, 140 Jan  4 05:37 /dev/da1
crw-r-----  1 root  operator    0, 141 Jan  4 05:37 /dev/da1s1
crw-r-----  1 root  operator    0, 147 Jan  4 05:45 /dev/da2
crw-r-----  1 root  operator    0, 148 Jan  4 05:45 /dev/da2s1

camcontrol device list ---------
<WDC WD3200AAKS-00VYA0 12.01B02>   at scbus0 target 0 lun 0 (ada0,pass0)
<hp DVDROM DH40N IS00>             at scbus2 target 0 lun 0 (pass1,cd0)
<  1.00>                           at scbus5 target 0 lun 0 (da0,pass2)
<USB 2.0 Flash Disk 1.00>          at scbus6 target 0 lun 0 (da1,pass3)
<Sony Storage Media 0100>          at scbus7 target 0 lun 0 (da2,pass4)

mount -o ro -t msdosfs /dev/da2s1 /mnt
Please note that I temporarily used "dump_info" command instead of "add_quirk" and that the mount command is only being displayed and not executed.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote