|
在FreeBSD下使用USB设备
原著 小龍女
=================================================================================
<1>
这几天为了demoAP而使劲微调我的FreeBSD内核,设备驱动砍掉一块又一块,到了USB这里偶开始有一点
犹豫了。正捉摸者,忽然发现这样一个设备选项:
#device umass
嗯...有点好玩儿,偶拿Linux做桌面好久了,USB硬盘,优盘,偶的DC和它也配合得很好,倒是一直没想
过在FreeBSD下使用这些。好吧,偶就做一次小白鼠,试试看在FreeBSD下使用偶的DC吧。
(FreeBSD版本: 5.1 release)
在FreeBSD下使用这些怪东东,最好的选择当然是自己重新编译一下内核。偶没有试默认内核是否支持,但
FreeBSD默认内核总是最大化编译的,所以应该本身就能够很好支持这些设备。如果不行的话就跟偶一起make
world吧。经过几次make kernel,总算摸清楚了它的depend关系,在BSD/Linux中,USB设备都是模拟为
SCSI设备的,所以当然你的内核得加上SCSI / USB 和 USBMass驱动才可以。
<2>
这样,至少你的内核文件中至少就该有如下选项:
===
# SCSI peripherals # SCSI 相关选项
device scbus # SCSI 总线支持 (必须)
device ch # SCSI media changers
device da # SCSI 磁盘支持 (必须)
# USB support # USB 相关选项
device uhci # UHCI PCI->USB USB接口 (必须)
device ohci # OHCI PCI->USB USB接口
device usb # USB 总线支持 (必须)
device ugen # Generic
#device ehci # USB 2.0总线支持,根据你的需要
device umass # USB块存储设备驱动
===
如果你需要真正能够使用这些设备的话,可能还需要加上这些以支持NTFS和FAT文件系统:
===
options NTFS
options MSDOSFS
===
<3>
使用下列命令编辑内核配置文件,并编译新内核:
# vi /sys/i386/conf/GENERIC # 添加或修改上段所写的选项
# cd /sys/i386/conf
# config GENERIC # 生成内核配置选项
# cd ../compile/GENERIC
# make depend && make install # 编译和安装内核
# reboot # 重新引导
<4>
如果以上几个步骤都没出错的话,那么你走运了,现在你应该可以使用优盘之类的设备了,不过还是先确认一下:
# dmesg |grep umass
# dmesg |more
在上面两条指令后,你至少可以看到这样的一段信息:
===
uhci0: <Intel 82801BA/BAM (ICH2) USB controller USB-A> port 0xa400-0xa41f irq 9
at device 31.2 on pci0
usb0: <Intel 82801BA/BAM (ICH2) USB controller USB-A> on uhci0
usb0: USB revision 1.0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
umass0: Genesys Logic USB TO IDE, rev 2.00/0.02, addr 2
===
如果你看到了umass0这一行,那么现在就插入你的USB移动硬盘,优盘,或是DC ~_*
插入之后,应该会立刻在控制台上显示一段很显眼的提示:
===
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <IC25N020 ATCS04-0 0811> Fixed Direct Access SCSI-0 device
da0: 1.000MB/s transfers
da0: 19077MB (39070080 512 byte sectors: 255H 63S/T 2432C)
(da0:umass-sim0:0:0:0): READ(6)/WRITE(6) not supported, increasing minimum_cmd_
size to 10.
===
上面是偶的IBM移动硬盘。
===
umass0: detached
umass0: Sony Sony DSC, rev 1.10/4.10, addr 2
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <Sony Sony DSC 4.10> Removable Direct Access SCSI-0 device
da0: 1.000MB/s transfers
da0: 123MB (253696 512 byte sectors: 64H 32S/T 123C)
===
上面是偶的Sony DSC-P7 数码相机。
<5>
然后,就可以直接mount这些设备:
# mount -tmsdos /dev/da0s1 /mnt
# ls -alF /mnt
total 50
drwxr-xr-x 1 root wheel 16384 Jan 1 1980 ./
drwxr-xr-x 17 root wheel 512 Jul 15 21:58 ../
drwxr-xr-x 1 root wheel 16384 Jan 5 2002 dcim/
-r-xr-xr-x 1 root wheel 0 Oct 26 2002 memstick.ind*
drwxr-xr-x 1 root wheel 16384 Jan 5 2002 mssony/
设备名一般是/dev/da0s1 <2/3/4...>,按照你的USB设备分区依次。
使用完之后别忘了先umount掉设备之后在拔掉哦,不然和在Windows下一样会得到一个警告提示的,一不
小心也会丢数据。
<6>
FreeBSD目前支持以下USB存储设备,如果你对USB系统熟悉的话,也可以自己添加或移植驱动。
(包含几乎全部闪盘,移动硬盘,记忆棒,大多数的USB CDROM/MO,和一些DC,MMC和SD未测试)
===
ADTEC Stick Drive AD-UST32M, 64M, 128M, 256M
Denno FireWire/USB2 Removable 2.5-inch HDD Case MIFU-25CB20
FujiFilm Zip USB Drive ZDR100 USB A
GREEN HOUSE USB Flash Memory ``PicoDrive'' GH-UFD32M, 64M, 128M
IBM 32MB USB Memory Key (P/N 22P5296)
IBM ThinkPad USB Portable CD-ROM Drive (P/N 33L5151)
I-O DATA USB x6 CD-RW Drive CDRW-i64/USB (CDROM only)
I-O DATA USB CD/CD-R/CD-RW/DVD-R/DVD-RW/DVD-RAM/DVD-ROM Drive DVR-iUH2 (CDROM,
DVD-RAM only)
Iomega USB Zip 100Mb (primitive support still)
Iomega Zip750 USB2.0 Drive
Keian USB1.1/2.0 3.5-inch HDD Case KU350A
Kurouto Shikou USB 2.5-inch HDD Case GAWAP2.5PS-USB2.0
Logitec USB1.1/2.0 HDD Unit SHD-E60U2
Logitec Mobile USB Memory LMC-256UD
Logitec USB Double-Speed Floppy Drive LFD-31U2
Logitec USB/IEEE1394 DVD-RAM/R/RW Unit LDR-N21FU2 (CDROM only)
Matshita CF-VFDU03 floppy drive
MELCO USB2.0 MO Drive MO-CH640U2
I-O DATA USB/IEEE1394 Portable HD Drive HDP-i30P/CI, HDP-i40P/CI
MELCO USB Flash Disk ``PetitDrive'', RUF-32M, -64M, -128M, -256M
MELCO USB2.0 Flash Disk ``PetitDrive2'', RUF-256M/U2, -512M/U2
MELCO USB Flash Disk ``ClipDrive'', RUF-C32M, -C64M, -C128M, -C256M, -C512M
Microtech USB-SCSI-HD 50 USB to SCSI cable
NOVAC USB2.0 2.5/3.5-inch HDD Case NV-HD351U
Panasonic floppy drive
Panasonic USB2.0 Portable CD-RW Drive KXL-RW40AN (CDROM only)
RATOC Systems USB2.0 Removable HDD Case U2-MDK1, U2-MDK1B
Sony Portable CD-R/RW Drive CRX10U (CDROM only)
TEAC Portable USB CD-ROM Unit CD-110PU/210PU
Y-E Data floppy drive (720/1.44/2.88Mb)
FreeBSD 5.1支持的USB控制器
===
ALi Aladdin-V
AMD-756
CMD Tech 670 & 673
Intel 82371SB (PIIX3)
Intel 82371AB and EB (PIIX4)
Intel 82801AA (ICH)
Intel 82801AB (ICH0)
Intel 82801BA/BAM (ICH2)
Intel 82443MX
NEC uPD 9210
OPTi 82C861 (FireLink)
SiS 5571
VIA 83C572 USB
其它 UHCI 或 OHCI 兼容主板
支持的USB HUB设备
===
ADS Electronics PCI plug-in card (2 ports)
Entrega PCI plug-in card (4 ports)
Andromeda hub
MacAlly self powered hub (4 ports)
NEC hub
================================================================================= |
|