找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 13662|回复: 29

USB 驱动软件 及自动加载脚本

[复制链接]
Installation
[edit]Install USB Kernel modules
ipkg install kmod-usb-uhci // this is for USB 1.1
ipkg install kmod-usb-core
ipkg install kmod-usb2
ipkg install kmod-usb-storage
[edit]Manual installation and check
insert the modules one by one by following commands in a telnet session.
insmod /jffs/lib/modules/2.4.30/usbcore.o
insmod /jffs/lib/modules/2.4.30/ehci-hcd.o
insmod /jffs/lib/modules/2.4.30/scsi_mod.o
insmod /jffs/lib/modules/2.4.30/usb-storage.o
insmod /jffs/lib/modules/2.4.30/sd_mod.o
[edit]Check
See the enabling from dmesg output of a Linksys WRTSL54GS. A SanDisk Cruzer Micro 4G flash drive as recognized.
/ # dmesg
<snip>
<6>ehci_hcd 01:02.2: PCI device 1033:00e0
<6>ehci_hcd 01:02.2: irq 2, pci mem c0181000
<6>usb.c: new USB bus registered, assigned bus number 1
<6>ehci_hcd 01:02.2: USB 2.0 enabled, EHCI 1.00, driver 2003-Dec-29/2.4
<6>hub.c: USB hub found
<6>hub.c: 5 ports detected
<6>hub.c: new USB device 01:02.2-1, assigned address 2
<4>usb.c: USB device 2 (vend/prod 0x781/0x5406) is not claimed by any active driver.
<6>SCSI subsystem driver Revision: 1.00
<6>Initializing USB Mass Storage driver...
<6>usb.c: registered new driver usb-storage
<6>scsi0 : SCSI emulation for USB Mass Storage devices
<0>  Vendor: SanDisk   Model: U3 Cruzer Micro   Rev: 2.18
<0>  Type:   Direct-Access                      ANSI SCSI revision: 02
<0>  Vendor: SanDisk   Model: U3 Cruzer Micro   Rev: 2.18
<0>  Type:   CD-ROM                             ANSI SCSI revision: 02
<7>WARNING: USB Mass Storage data integrity not assured
<7>USB Mass Storage device found at 2
<6>USB Mass Storage support registered.
<0>Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
<0>SCSI device sda: 8015505 512-byte hdwr sectors (4104 MB)
<0>sda: Write Protect is off
<6>Partition check:
<6> /dev/scsi/host0/bus0/target0/lun0: p1 p2 p3
/ #

[edit]Create a startup script that loads the modules
Create a file, usb.startup in /jffs/etc/config/ directory

~ # mkdir /jffs/etc/config
~ # vi /jffs/etc/config/usb.startup
that contains this (press i once for insert mode):

#!/bin/sh
insmod /jffs/lib/modules/2.4.30/usbcore.o
insmod /jffs/lib/modules/2.4.30/ehci-hcd.o
insmod /jffs/lib/modules/2.4.30/scsi_mod.o
insmod /jffs/lib/modules/2.4.30/usb-storage.o
# remove the dash (#) from the line below if you use USB 1.1
#insmod /jffs/lib/modules/2.4.30/uhci.o
insmod /jffs/lib/modules/2.4.30/sd_mod.o
vi is ended using "ESC" and then :wq

make the script executable:

chmod +x /jffs/etc/config/usb.startup
[edit]For DD-WRT v23 SP1 or below
add the follwing script to startup. It executes on every reboot all *.startup scripts located in /jffs/etc/config/

console mode
> ~ # nvram set rc_startup="
> for I in `/bin/ls /jffs/etc/config/*.startup`
> do
>    sh $I &
> done
> "
> ~ # nvram commit
>
web interface mode
for I in `/bin/ls /jffs/etc/config/*.startup`
   do
     sh $I &
done

This is it. Here's my dmesg from Asus WL-500gP

dmesg
SCSI subsystem driver Revision: 1.00
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
USB Mass Storage support registered.
uhci.c: USB Universal Host Controller Interface driver v1.1
PCI: Enabling device 01:03.0 (0000 -> 0001)
uhci.c: USB UHCI at I/O 0x100, IRQ 2
usb.c: new USB bus registered, assigned bus number 2
hub.c: USB hub found
hub.c: 2 ports detected
PCI: Enabling device 01:03.1 (0000 -> 0001)
uhci.c: USB UHCI at I/O 0x120, IRQ 2
usb.c: new USB bus registered, assigned bus number 3
hub.c: USB hub found
hub.c: 2 ports detected
[edit]kernel modules for filesystems
Now to access FAT/EXT/XFS partitions you must install

ipkg install kmod-vfat
ipkg install kmod-ext2
ipkg install kmod-ext3
ipkg install kmod-xfs
[edit]autoload filesystem modules
Add to /jffs/etc/config/usb.startup (comment out lines you don't need to save memory)

# FAT
insmod /jffs/lib/modules/2.4.30/fat.o
insmod /jffs/lib/modules/2.4.30/vfat.o
#XFS
#insmod /jffs/lib/modules/2.4.30/xfs.o
#EXT2
#insmod /jffs/lib/modules/2.4.30/ext2.o
#EXT2
#insmod /jffs/lib/modules/2.4.30/ext3.o

Now dmesg should show (The example below is from a 80 GB HD)

Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
Partition check:
/dev/scsi/host0/bus0/target0/lun0
[edit]Multislot card reader
In order to use a multislot card reader, you must add the following parameter to the scsi_mod in the file /jffs/etc/modules.d/60-usb-storage:

scsi_mod max_scsi_luns=8
[edit]Usage
[edit]Mounting
mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt
[edit]Performance Testing
With help of the hdparm package you could test your performance. On an Asus WL-500gP(remium) without overclocking you will get

hdparm -tT /dev/scsi/host0/bus0/target0/lun0/part2
Timing cached reads:   188 MB in  2.04 seconds =  92.16 MB/sec
Timing buffered disk reads:   24 MB in  3.19 seconds =   7.52 MB/sec

Please note overclocking wouldn&acute;t get you significant more performance on Asus WL-500gP(remium) Router.

[edit]On a WRTSL54G with 4G flash disk
/ # hdparm -tT /dev/scsi/host0/bus0/target0/lun0/part2

/dev/scsi/host0/bus0/target0/lun0/part2:
Timing cached reads:   148 MB in  2.03 seconds =  72.91 MB/sec
Timing buffered disk reads:   24 MB in  3.22 seconds =   7.45 MB/sec
/ #

[edit]Listing Contents
ls -l /mnt
You can also add the above line to /jffs/etc/config/usb.startup to mount the partition on reboot

# multiple partitions
mkdir /tmp/usb
mkdir /tmp/usb/1
# wait to recognize devices properly
sleep 2
# mount first partition
/bin/mount /dev/scsi/host0/bus0/target0/lun0/part1 /tmp/usb/1
# list its contents
ls -l /tmp/usb/1
# second partition
mkdir /tmp/usb/2
mount /dev/scsi/host0/bus0/target0/lun0/part2 /tmp/usb/2
# list its contents
ls -l /tmp/usb/2
我的恩山、我的无线 The best wifi forum is right here.
好东西~~~~先收起来!谢谢LZ呀!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
[edit]Create a startup script that loads the modules
Create a file, usb.startup in /jffs/etc/config/ directory

~ # mkdir /jffs/etc/config
~ # vi /jffs/etc/config/usb.startup
that contains this (press i once for insert mode):

#!/bin/sh
insmod /jffs/lib/modules/2.4.30/usbcore.o
insmod /jffs/lib/modules/2.4.30/ehci-hcd.o
insmod /jffs/lib/modules/2.4.30/scsi_mod.o
insmod /jffs/lib/modules/2.4.30/usb-storage.o
# remove the dash (#) from the line below if you use USB 1.1
#insmod /jffs/lib/modules/2.4.30/uhci.o
insmod /jffs/lib/modules/2.4.30/sd_mod.o
vi is ended using "ESC" and then :wq

make the script executable:

chmod +x /jffs/etc/config/usb.startup
[edit]For DD-WRT v23 SP1 or below
add the follwing script to startup. It executes on every reboot all *.startup scripts located in /jffs/etc/config/

console mode
> ~ # nvram set rc_startup="
> for I in `/bin/ls /jffs/etc/config/*.startup`
> do
>    sh $I &
> done
> "
> ~ # nvram commit
>
web interface mode
for I in `/bin/ls /jffs/etc/config/*.startup`
   do
     sh $I &
done
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
开机可以自动加载

硬件操作可以参考 WVR+USB的文章
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

怎么安装啊?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

讲细点,菜鸟求援.
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

顶上去.
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
先要改好硬件,这个我是在 WVR上面实现的
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
软件加载这个部分转载 自 国外的网站

看懂一分英文的人  就应该知道啦

怕翻译的不好,就没动
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
#!/bin/sh
insmod /jffs/usb/usbcore.o
insmod /jffs/usb/usb-uhci.o
insmod /jffs/usb/scsi_mod.o
insmod /jffs/usb/usb-storage.o
# remove the dash (#) from the line below if you use USB 1.1
insmod /jffs/usb/uhci.o
insmod /jffs/usb/sd_mod.o
insmod /jffs/usb/fat.o
insmod /jffs/usb/vfat.o
insmod /jffs/usb/msdos.o
mkdir /tmp/usbdisk
mkdir /tmp/sonyms
/bin/mount /dev/scsi/host0/bus0/target0/lun0/part1 /tmp/usbdisk
/bin/mount /dev/scsi/host0/bus0/target0/lun3/part1 /tmp/sonyms
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
DD-WRT v24 std (c) 2007 NewMedia-NET GmbH
Release: 05/16/07 (SVN revision: 7097)
==========================================================

____  ___    __        ______ _____         ____  _  _
| _ \| _ \   \ \      / /  _ \_   _| __   _|___ \| || |
|| | || ||____\ \ /\ / /| |_) || |   \ \ / / __) | || |_
||_| ||_||_____\ V  V / |  _ < | |    \ V / / __/|__   _|
|___/|___/      \_/\_/  |_| \_\|_|     \_/ |_____|  |_|

                       DD-WRT v24
                   http://www.dd-wrt.com

==========================================================


BusyBox v1.4.2 (2007-05-16 04:37:56 CEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ # dmesg
CPU revision is: 00029006
Linux version 2.4.34 (root@dd-wrt) (gcc version 3.4.4 (OpenWrt-2.0)) #1138 Wed May 16 04:42:01 CEST 2007
sbinfo: 2052 8 4
Setting the PFC to its default value
Determined physical RAM map:
memory: 04000000 @ 00000000 (usable)
On node 0 totalpages: 16384
zone(0): 16384 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200
CPU: BCM4704 rev 8 at 264 MHz
Using 132.000 MHz high precision timer.
Calibrating delay loop... 262.96 BogoMIPS
Dentry cache hash table entries: 8192 (order: 4, 65536 bytes)
Inode cache hash table entries: 4096 (order: 3, 32768 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 4096 (order: 2, 16384 bytes)
Page-cache hash table entries: 16384 (order: 4, 65536 bytes)
Checking for 'wait' instruction...  unavailable.
POSIX conformance testing by UNIFIX
PCI: Initializing host
PCI: Fixing up bus 0
PCI: Fixing up bridge
PCI: Setting latency timer of device 01:00.0 to 64
PCI: Fixing up bus 1
Initializing RT netlink socket
Starting kswapd
devfs: v1.12c (20020818) Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
squashfs: version 3.0 (2006/03/15) Phillip Lougher
pty: 256 Unix98 ptys configured
Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI enabled
ttyS00 at 0xb8000300 (irq = 3) is a 16550A
ttyS01 at 0xb8000400 (irq = 3) is a 16550A
Software Watchdog Timer: 0.05, timer margin: 60 sec
PCI: Setting latency timer of device 00:01.0 to 64
PCI: Setting latency timer of device 00:02.0 to 64
imq driver loaded.
Universal TUN/TAP device driver 1.5 (C)1999-2002 Maxim Krasnyansky
Physically mapped flash: Found an alias at 0x800000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1000000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1800000 for the chip at 0x0
Amd/Fujitsu Extended Query Table v1.1 at 0x0040
Physically mapped flash: Swapping erase regions for broken CFI table.
number of CFI chips: 1
cfi_cmdset_0002: Disabling fast programming due to code brokenness.
Flash device: 0x800000 at 0x1c000000
bootloader size: 262144
Physically mapped flash: Filesystem type: squashfs, size=0x2eb277
Creating 5 MTD partitions on "Physically mapped flash":
0x00000000-0x00040000 : "cfe"
0x00040000-0x007f0000 : "linux"
0x000cc880-0x003c0000 : "rootfs"
mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-only
0x007f0000-0x00800000 : "nvram"
0x003c0000-0x007f0000 : "ddwrt"
Initializing Cryptographic API
IP Protocols: ICMP, UDP, TCP, IGMP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 4096 bind 8192)
ip_conntrack version 2.1 (512 buckets, 4096 max) - 336 bytes per conntrack
ip_tables: (C) 2000-2002 Netfilter core team
IPP2P v0.8.2 loading
ipt_random match loaded
netfilter PSD loaded - (c) astaro AG
ipt_osf: Startng OS fingerprint matching module.
ipt_IPV4OPTSSTRIP loaded
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
VFS: Mounted root (squashfs filesystem) readonly.
Mounted devfs on /dev
diag boardtype: 0000042f
PCI: Setting latency timer of device 01:01.0 to 64
PCI: Enabling device 01:01.0 (0004 -> 0006)
sbinfo: 2052 9 4
eth2: Broadcom BCM4320 802.11 Wireless Controller 4.80.56.0
JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00428000: 0x4c46 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00428004: 0x5ee8 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00428008: 0x01cd instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0042800c: 0x0062 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00428010: 0x0407 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00428014: 0x6c6f instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00428018: 0x5f64 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0042801c: 0x6576 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00428020: 0x6567 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00428024: 0x7300 instead
Further such events for this erase block will not be printed
JFFS2: Erase block at 0x00420000 is not formatted. It will be erased
device eth0 entered promiscuous mode
device eth2 entered promiscuous mode
device eth1 entered promiscuous mode
device br0 entered promiscuous mode
usb.c: registered new driver usbdevfs
usb.c: registered new driver hub
uhci.c: USB Universal Host Controller Interface driver v1.1
PCI: Setting latency timer of device 00:03.0 to 64
usb-ohci.c: USB OHCI at membase 0xb8003000, IRQ 6
usb-ohci.c: usb-00:03.0, PCI device 14e4:4715
usb.c: new USB bus registered, assigned bus number 1
hub.c: USB hub found
hub.c: 2 ports detected
SCSI subsystem driver Revision: 1.00
hub.c: new USB device 00:03.0-1, assigned address 2
hub.c: USB hub found
hub.c: 4 ports detected
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
USB Mass Storage support registered.
hub.c: new USB device 00:03.0-1.1, assigned address 3
scsi0 : SCSI emulation for USB Mass Storage devices
resize_dma_pool: unknown device type -1
  Vendor: Generic   Model: USB SD Reader     Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 02
  Vendor: Generic   Model: USB CF Reader     Rev: 1.01
  Type:   Direct-Access                      ANSI SCSI revision: 02
  Vendor: Generic   Model: USB SM Reader     Rev: 1.02
  Type:   Direct-Access                      ANSI SCSI revision: 02
  Vendor: Generic   Model: USB MS Reader     Rev: 1.03
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
Attached scsi removable disk sdb at scsi0, channel 0, id 0, lun 1
Attached scsi removable disk sdc at scsi0, channel 0, id 0, lun 2
Attached scsi removable disk sdd at scsi0, channel 0, id 0, lun 3
SCSI device sda: 1003520 512-byte hdwr sectors (514 MB)
sda: Write Protect is off
Partition check:
/dev/scsi/host0/bus0/target0/lun0: p1
sdb: Unit Not Ready, sense:
Info fld=0x0, Current 00:00: sns = f0  2
ASC=3a ASCQ= 0
Raw sense data:0xf0 0x09 0x02 0x00 0x00 0x00 0x00 0x0a 0x00 0xaa 0x55 0x49 0x3a 0x00 0x01 0x00 0x00 0x00
sdb : READ CAPACITY failed.
sdb : status = 1, message = 00, host = 0, driver = 08
Info fld=0x0, Current sd00:00: sns = f0  2
ASC=3a ASCQ= 0
Raw sense data:0xf0 0x09 0x02 0x00 0x00 0x00 0x00 0x0a 0x00 0xaa 0x55 0x49 0x3a 0x00 0x01 0x00 0x00 0x00
sdb : block size assumed to be 512 bytes, disk size 1GB.  
/dev/scsi/host0/bus0/target0/lun1: I/O error: dev 08:10, sector 0
I/O error: dev 08:10, sector 0
unable to read partition table
sdc: Unit Not Ready, sense:
Info fld=0x0, Current 00:00: sns = f0  2
ASC=3a ASCQ= 0
Raw sense data:0xf0 0x09 0x02 0x00 0x00 0x00 0x00 0x0a 0x00 0xaa 0x55 0x49 0x3a 0x00 0x01 0x00 0x00 0x00
sdc : READ CAPACITY failed.
sdc : status = 1, message = 00, host = 0, driver = 08
Info fld=0x0, Current sd00:00: sns = f0  2
ASC=3a ASCQ= 0
Raw sense data:0xf0 0x09 0x02 0x00 0x00 0x00 0x00 0x0a 0x00 0xaa 0x55 0x49 0x3a 0x00 0x01 0x00 0x00 0x00
sdc : block size assumed to be 512 bytes, disk size 1GB.  
/dev/scsi/host0/bus0/target0/lun2: I/O error: dev 08:20, sector 0
I/O error: dev 08:20, sector 0
unable to read partition table
SCSI device sdd: 487936 512-byte hdwr sectors (250 MB)
sdd: Write Protect is off
/dev/scsi/host0/bus0/target0/lun3: p1
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 3
hub.c: new USB device 00:03.0-1.3, assigned address 4
usb.c: USB device 4 (vend/prod 0xac8/0x307b) is not claimed by any active driver.
hub.c: already running port 1 disabled by hub (EMI?), re-enabling...
usb.c: USB disconnect on device 00:03.0-1 address 2
usb.c: USB disconnect on device 00:03.0-1.1 address 3
usb.c: USB disconnect on device 00:03.0-1.3 address 4
hub.c: new USB device 00:03.0-1, assigned address 5
hub.c: USB hub found
hub.c: 4 ports detected
hub.c: new USB device 00:03.0-1.1, assigned address 6
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 6
hub.c: new USB device 00:03.0-1.3, assigned address 7
usb.c: USB device 7 (vend/prod 0xac8/0x307b) is not claimed by any active driver.
~ # df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/root                 3008      3008         0 100% /
/dev/mtdblock/4           4288       916      3372  21% /jffs
/dev/scsi/host0/bus0/target0/lun0/part1    501480       344    501136   0% /tmp/usbdisk
/dev/scsi/host0/bus0/target0/lun3/part1    243372         4    243368   0% /tmp/sonyms
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

是让dd通过jffs来支持USB么
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
是的,支持USB存储、或是读卡器!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

USB 驱动软件z在那里下载呢,各位大哥
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

usbcore.o
ehci-hcd.o
scsi_mod.o
usb-storage.o

z这些在那里下?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-27 05:34

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表