debian 化(12)USB モジュールロード/アンロードの rc 化

LS-HGL

USB を使う方法がわかったので、起動時に有効になるように rc 化する。

/etc/init.d/usb の作成

hackkit:/etc/init.d# cat /etc/init.d/usb
#!/bin/sh

case "$1" in
  start)
        echo on > /proc/buffalo/usb_control
        chroot /usr/local/buffalo insmod /lib/modules/2.6.16.16-arm1/kernel/drivers/usb/core/usbcore.ko
        chroot /usr/local/buffalo insmod /lib/modules/usblp.ko
        chroot /usr/local/buffalo insmod /lib/modules/2.6.16.16-arm1/kernel/drivers/usb/host/ehci-marvell-hcd.ko
        chroot /usr/local/buffalo insmod /lib/modules/2.6.16.16-arm1/kernel/drivers/usb/storage/usb-storage.ko
        chroot /usr/local/buffalo insmod /lib/modules/2.6.16.16-arm1/kernel/fs/fat/fat.ko
        chroot /usr/local/buffalo insmod /lib/modules/2.6.16.16-arm1/kernel/fs/vfat/vfat.ko
        ;;
  stop)
        chroot /usr/local/buffalo rmmod vfat.ko
        chroot /usr/local/buffalo rmmod fat.ko
        chroot /usr/local/buffalo rmmod usb-storage.ko
        chroot /usr/local/buffalo rmmod ehci-marvell-hcd.ko
        chroot /usr/local/buffalo rmmod usblp.ko
        chroot /usr/local/buffalo rmmod usbcore.ko
        echo off > /proc/buffalo/usb_control
        ;;
  *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac

exit 0
hackkit:/etc/init.d# chmod +x usb
hackkit:/etc/init.d# 

シンボリックリンク

各ランレベルにシンボリックリンクを張る。
hackkit:/etc# ln -s ../init.d/usb rc0.d/K85usb
hackkit:/etc# ln -s ../init.d/usb rc1.d/K85usb
hackkit:/etc# ln -s ../init.d/usb rc2.d/S15usb
hackkit:/etc# ln -s ../init.d/usb rc3.d/S15usb
hackkit:/etc# ln -s ../init.d/usb rc4.d/S15usb
hackkit:/etc# ln -s ../init.d/usb rc5.d/S15usb
hackkit:/etc# ln -s ../init.d/usb rc6.d/K85usb
hackkit:/etc# ls -l rc*/*usb
lrwxrwxrwx 1 root root 13 Apr  5 12:03 rc0.d/K85usb -> ../init.d/usb
lrwxrwxrwx 1 root root 13 Apr  5 12:03 rc1.d/K85usb -> ../init.d/usb
lrwxrwxrwx 1 root root 13 Apr  5 12:04 rc2.d/S15usb -> ../init.d/usb
lrwxrwxrwx 1 root root 13 Apr  5 12:04 rc3.d/S15usb -> ../init.d/usb
lrwxrwxrwx 1 root root 13 Apr  5 12:04 rc4.d/S15usb -> ../init.d/usb
lrwxrwxrwx 1 root root 13 Apr  5 12:04 rc5.d/S15usb -> ../init.d/usb
lrwxrwxrwx 1 root root 13 Apr  5 12:04 rc6.d/K85usb -> ../init.d/usb
hackkit:/etc#
こんなところか。

再起動

再起動すると、シリアルコンソールには
	:
	:
usbcore: registered new driver usbfs
usbcore: registered new driver hub
usbcore: registered new driver usblp
drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver
ehci_platform ehci_platform.4523: EHCI Platform Host Controller
ehci_platform ehci_platform.4523: new USB bus registered, assigned bus number 1
ehci_platform ehci_platform.4523: irq 17, io mem 0x00000000
ehci_platform ehci_platform.4523: USB 0.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ehci_platform ehci_platform.16781: EHCI Platform Host Controller
ehci_platform ehci_platform.16781: new USB bus registered, assigned bus number 2
ehci_platform ehci_platform.16781: irq 12, io mem 0x00000000
ehci_platform ehci_platform.16781: USB 0.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
	:
	:

USB メモリを刺す

USB メモリを刺してみる。
usb 1-1: new full speed USB device using ehci_platform and address 2
usb 1-1: configuration #1 chosen from 1 choice
scsi2 : SCSI emulation for USB Mass Storage devices
  Vendor: BUFFALO   Model: ClipDrive         Rev: 1.88
  Type:   Direct-Access                      ANSI SCSI revision: 02
SCSI device sdb: 256000 512-byte hdwr sectors (131 MB)
sdb: Write Protect is off
sdb: assuming drive cache: write through
SCSI device sdb: 256000 512-byte hdwr sectors (131 MB)
sdb: Write Protect is off
sdb: assuming drive cache: write through
 sdb: sdb1
sd 2:0:0:0: Attached scsi removable disk sdb
sd 2:0:0:0: Attached scsi generic sg1 type 0
いけてそう。

USB メモリを抜く

usb 1-1: USB disconnect, address 2

USB プリンタを刺す

usb 1-1: new full speed USB device using ehci_platform and address 3
usb 1-1: configuration #1 chosen from 1 choice
drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 3 if 0 alt 0 proto 2 vid 0x04B8 pid 0x0005

USB プリンタを抜く

usb 1-1: USB disconnect, address 3
drivers/usb/class/usblp.c: usblp0: removed

シャットダウン

電源ボタンを OFF にする。
	:
	:
usbcore: deregistering driver usb-storage
USB: ehci_platform_remove
ehci_platform ehci_platform.16781: remove, state 1
usb usb2: USB disconnect, address 1
ehci_platform ehci_platform.16781: USB bus 2 deregistered
USB: ehci_platform_remove
ehci_platform ehci_platform.4523: remove, state 1
usb usb1: USB disconnect, address 1
ehci_platform ehci_platform.4523: USB bus 1 deregistered
usbcore: deregistering driver usblp
usbcore: deregistering driver usbfs
usbcore: deregistering driver hub
	:
	:
OK

LS-H250GL
楽天市場
livedoor デパート
Sofmap
TSUKUMO ネットショップ
TWO TOP
Yahoo!ショッピング
パソQ
ムラウチドットコム
ヤマダ電機WEB
アット・ニフティストア icon
Joshin インターネットショッピング icon


debian 化(11)モジュールのアンロード
ハックの記録
LinkStation/玄箱 をハックしよう

debian 化(13)ハックキットインストーラの修正

Copyright (C) 2003-2008 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市