![]() |
|
|||||||
| FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|||
|
Hi all,
On my FreeBSD 9.0 PC, I have issues with external USB drives. Just figured out, I need to execute a command after plugging one in (and before mounting it): # usbconfig -d ugen3.2 add_quirk UQ_OPEN_CLEARSTALL Several questions: - What does ugen3.2 mean? Can I blindly type this every time, or does this number change, say in the order of attaching USB devices or depending on the USB port? - The drive is supposed to be mounted in fstab. What is the FreeBSD way of automatically executing the above usbconfig command in conjunction with fstab? Bash |
|
|||
|
From ugen(4)
Code:
NAME
ugen - USB generic device support
SYNOPSIS
ugen* at uhub?
DESCRIPTION
The ugen driver provides support for all USB devices that do not have a
special driver. It supports access to all parts of the device, but not
in a way that is as convenient as a special purpose driver.
There can be up to 127 USB devices connected to a USB bus. Each USB
device can have up to 16 endpoints.
Code:
# dmesg |grep ugenugen0.1: <Intel> at usbus0 ugen1.1: <Intel> at usbus1 ugen0.2: <vendor 0x8087> at usbus0 ugen1.2: <vendor 0x8087> at usbus1 ugen1.3: <ServerEngines> at usbus1 ugen1.4: <Kingston> at usbus1 If I plug in another USB stick I see the following: Code:
# tail -f /var/log/messages Jan 4 05:37:50 usb-8g kernel: ugen1.5: <Prolific Technology Inc.> at usbus1 Jan 4 05:37:50 usb-8g kernel: uhub4: <Prolific Technology Inc. USB Embedded Hub, class 9/0, rev 2.00/1.00, addr 5> on usbus1 Jan 4 05:37:50 usb-8g kernel: uhub4: 1 port with 0 removable, self powered Jan 4 05:37:52 usb-8g kernel: ugen1.6: <Prolific Technology Inc.> at usbus1 Jan 4 05:37:52 usb-8g kernel: umass1: <Prolific Technology Inc. USB Mass Storage Device, class 0/0, rev 2.00/1.00, addr 6> on usbus1 Jan 4 05:37:52 usb-8g kernel: umass1: 8070i (ATAPI) over Bulk-Only; quirks = 0x4100 Jan 4 05:37:52 usb-8g kernel: umass1:6:1:-1: Attached to scbus6 Jan 4 05:37:52 usb-8g kernel: da1 at umass-sim1 bus 1 scbus6 target 0 lun 0 Jan 4 05:37:52 usb-8g kernel: da1: <USB 2.0 Flash Disk 1.00> Removable Direct Access SCSI-0 device Jan 4 05:37:52 usb-8g kernel: da1: 40.000MB/s transfers Jan 4 05:37:52 usb-8g kernel: da1: 992MB (2031616 512 byte sectors: 64H 32S/T 992C) Code:
# usbconfig -d 1.5 dump_info ugen1.5: <USB Embedded Hub Prolific Technology Inc.> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE # usbconfig -d 1.6 dump_info ugen1.6: <USB Mass Storage Device Prolific Technology Inc.> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON Code:
Jan 4 05:45:58 usb-8g kernel: ugen0.3: <Sony> at usbus0 Jan 4 05:45:58 usb-8g kernel: umass2: <Sony Storage Media, class 0/0, rev 2.00/1.00, addr 3> on usbus0 Jan 4 05:45:58 usb-8g kernel: umass2: SCSI over Bulk-Only; quirks = 0x0100 Jan 4 05:45:58 usb-8g kernel: umass2:7:2:-1: Attached to scbus7 Jan 4 05:45:58 usb-8g kernel: da2 at umass-sim2 bus 2 scbus7 target 0 lun 0 Jan 4 05:45:58 usb-8g kernel: da2: <Sony Storage Media 0100> Removable Direct Access SCSI-0 device Jan 4 05:45:58 usb-8g kernel: da2: 40.000MB/s transfers Jan 4 05:45:58 usb-8g kernel: da2: 1920MB (3932160 512 byte sectors: 255H 63S/T 244C)
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
|
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
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
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
|
Thank you for your script. I use it as a starting point.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with some more sensible fstab defaults | maxrussell | FreeBSD General | 4 | 18th July 2009 02:44 PM |
| C F Card and fstab | terryd | FreeBSD General | 1 | 3rd December 2008 04:26 PM |
| Mounting ext2 in fstab | latorion | FreeBSD General | 3 | 6th August 2008 04:56 PM |
| mount fusefs (sshfs) from fstab | elon | FreeBSD General | 4 | 29th July 2008 06:41 PM |
| fstab and CD/DVD device | corneliu | FreeBSD General | 7 | 24th May 2008 02:11 AM |