pepoとネットワークを語ろう

40年前からこれまでとこれからのネットワークを語る

LinuxのUSB Driverのdebugやでー!4

2011-05-02 10:08:45 | Linux

さて、USB Driverのdebugでもう一つ興味があるのがusbmonだ、
使えるようにするには、Kernelのmake menuconfigでCONFIG_USB_MONとCONFIG_DEBUG_FSをYESにするよ
[root@linux-2.6.35.6-pepo]# make menuconfig
CONFIG_USB_MON:                                                         x
  x                                                                         x
  x If you select this option, a component which captures the USB traffic   x
  x between peripheral-specific drivers and HC drivers will be built.       x
  x For more information, see <file:Documentation/usb/usbmon.txt>.          x
  x                                                                         x
  x If unsure, say Y, if allowed, otherwise M.                              x
  x                                                                         x
  x Symbol: USB_MON [=m]                                                    x
  x Prompt: USB Monitor                                                     x
  x   Defined at drivers/usb/mon/Kconfig:5                                  x
  x   Depends on: USB_SUPPORT [=y] && USB [=y]                              x
  x   Location:                                                             x
  x     -> Device Drivers                                                   x
  x       -> USB support (USB_SUPPORT [=y])                                 x
  x         -> Support for Host-side USB (USB [=y])

CONFIG_DEBUG_FS:                                                        x
  x                                                                         x
  x debugfs is a virtual file system that kernel developers use to put      x
  x debugging files into.  Enable this option to be able to read and        x
  x write to these files.                                                   xx
  x                                                                         x
  x For detailed documentation on the debugfs API, see                      x
  x Documentation/DocBook/filesystems.                                      x
  x                                                                         x
  x If unsure, say N.                                                       x
  x                                                                         x
  x Symbol: DEBUG_FS [=y]                                                   x
  x Prompt: Debug Filesystem                                                x
  x   Defined at lib/Kconfig.debug:77                                       x
  x   Depends on: SYSFS [=y]                                                x
  x   Location:                                                             x
  x     -> Kernel hacking

詳しくは下記のKernel Documentationを確認してもらったら良いのだが
root@linux-2.6.35.6-pepo]# less Documentation/usb/usbmon.txt
まずは、どんなんかを紹介
[root@linux-2.6.35.6-pepo]# mount -t debugfs none_debugs /sys/kernel/debug
dfコマンドでは確認出来ないので、mountコマンドでマウント状態確認を
[root@linux-2.6.35.6-pepo]# mount
/proc on /proc type proc (rw,relatime)
/sys on /sys type sysfs (rw,relatime)
udev on /dev type devtmpfs (rw,relatime,size=119700k,nr_inodes=29925,mode=755)
/dev/pts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)
/dev/shm on /dev/shm type tmpfs (rw,relatime)
/proc/bus/usb on /proc/bus/usb type usbfs (rw,relatime)
none on /dev type tmpfs (rw,relatime,mode=755)
tmpfs on / type tmpfs (rw,relatime,size=167936k)
/dev/scd0 on /pepo-cdrom type iso9660 (ro,relatime)
/dev/loop0 on /BINMP type squashfs (ro,relatime)
unionfs on /BINRW type unionfs (rw,relatime,dirs=/UNION=rw:/BINMP=ro)
/dev/loop1 on /USRMP type squashfs (ro,relatime)
unionfs on /usr type unionfs (rw,relatime,dirs=/UNION=rw:/USRMP=ro)
/proc on /proc type proc (rw,relatime)
/sys on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)
/dev/sda1 on /mnt/hdd type ext2 (rw)
none_debugs on /sys/kernel/debug type debugfs (rw)

一番最後の行に何やら怪しげなdebugfsがmountされてま
何が分るかは後に続くよ

pepo


LinuxのUSB Driverのdebugやでー!3

2011-05-02 08:38:09 | Linux

さて、LinuxのUSB Driverの監視が出来るようになったところで
くじらのだんなが開発中のacm-FOMAの実際のlogを見てみる
これはPepoLinuxのUSBへFOMA携帯を接続と取り外しを行った時のログ出力だ

[root@~]# tail -f /var/log/debug
Apr 27 22:26:56 epicon kernel: klogd 1.4.1, log source = /proc/kmsg started.
Apr 27 22:29:45 epicon kernel: hub 2-0:1.0: state 7 ports 2 chg 0000 evt 0002
Apr 27 22:29:45 epicon kernel: uhci_hcd 0000:02:00.0: port 1 portsc 0083,00
Apr 27 22:29:45 epicon kernel: hub 2-0:1.0: port 1, status 0101, change 0001, 12 Mb/s
Apr 27 22:29:46 epicon kernel: hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x101
Apr 27 22:29:46 epicon kernel: usb 2-1: new full speed USB device using uhci_hcd and address 8
Apr 27 22:29:48 epicon kernel: usb 2-1: skipped 2 descriptors after configuration
Apr 27 22:29:48 epicon kernel: usb 2-1: skipped 5 descriptors after interface
Apr 27 22:29:48 epicon kernel: usb 2-1: skipped 5 descriptors after interface
Apr 27 22:29:48 epicon kernel: usb 2-1: skipped 3 descriptors after interface
Apr 27 22:29:48 epicon kernel: usb 2-1: default language 0x0409
Apr 27 22:29:48 epicon kernel: usb 2-1: udev 8, busnum 2, minor = 135
Apr 27 22:29:48 epicon kernel: usb 2-1: New USB device found, idVendor=0409, idProduct=0270
Apr 27 22:29:48 epicon kernel: usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Apr 27 22:29:48 epicon kernel: usb 2-1: Product: FOMA N09A
Apr 27 22:29:48 epicon kernel: usb 2-1: Manufacturer: NEC
Apr 27 22:29:48 epicon kernel: usb 2-1: SerialNumber: ****5902186****
Apr 27 22:29:48 epicon kernel: usb 2-1: usb_probe_device
Apr 27 22:29:48 epicon kernel: usb 2-1: configuration #1 chosen from 1 choice
Apr 27 22:29:48 epicon kernel: usb 2-1: adding 2-1:1.0 (config #1, interface 0)
Apr 27 22:29:48 epicon kernel: usbserial_generic 2-1:1.0: usb_probe_interface
Apr 27 22:29:48 epicon kernel: usbserial_generic 2-1:1.0: usb_probe_interface - got id
Apr 27 22:29:48 epicon kernel: usb 2-1: adding 2-1:1.1 (config #1, interface 1)
Apr 27 22:29:48 epicon kernel: usbserial_generic 2-1:1.1: usb_probe_interface
Apr 27 22:29:48 epicon kernel: usbserial_generic 2-1:1.1: usb_probe_interface - got id
Apr 27 22:29:48 epicon kernel: usb 2-1: adding 2-1:1.2 (config #1, interface 2)
Apr 27 22:29:48 epicon kernel: usbserial_generic 2-1:1.2: usb_probe_interface
Apr 27 22:29:48 epicon kernel: usbserial_generic 2-1:1.2: usb_probe_interface - got id
Apr 27 22:29:48 epicon kernel: usb 2-1: adding 2-1:1.3 (config #1, interface 3)
Apr 27 22:29:48 epicon kernel: usbserial_generic 2-1:1.3: usb_probe_interface
Apr 27 22:29:48 epicon kernel: usbserial_generic 2-1:1.3: usb_probe_interface - got id
Apr 27 22:29:48 epicon kernel: usb 2-1: adding 2-1:1.4 (config #1, interface 4)
Apr 27 22:29:48 epicon kernel: usbserial_generic 2-1:1.4: usb_probe_interface
Apr 27 22:29:48 epicon kernel: usbserial_generic 2-1:1.4: usb_probe_interface - got id
Apr 27 22:29:48 epicon kernel: drivers/usb/core/inode.c: creating file '008'
Apr 27 22:29:50 epicon kernel: acm_FOMA 2-1:1.0: usb_probe_interface
Apr 27 22:29:50 epicon kernel: acm_FOMA 2-1:1.0: usb_probe_interface - got id
Apr 27 22:29:50 epicon kernel: drivers/usb/class/acm-FOMA.c: interfaces are valid
Apr 27 22:29:50 epicon kernel: acm_FOMA 2-1:1.0: ttyACM0: USB ACM device
Apr 27 22:29:50 epicon kernel: drivers/usb/class/acm-FOMA.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: -32
Apr 27 22:29:50 epicon kernel: drivers/usb/class/acm-FOMA.c: acm_control_msg: rq: 0x20 val: 0x0 len: 0x7 result: -32
Apr 27 22:29:50 epicon kernel: acm_FOMA 2-1:1.2: usb_probe_interface
Apr 27 22:29:50 epicon kernel: acm_FOMA 2-1:1.2: usb_probe_interface - got id
Apr 27 22:29:50 epicon kernel: drivers/usb/class/acm-FOMA.c: interfaces are valid
Apr 27 22:29:50 epicon kernel: acm_FOMA 2-1:1.2: ttyACM1: USB ACM device
Apr 27 22:29:50 epicon kernel: drivers/usb/class/acm-FOMA.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: -32
Apr 27 22:29:50 epicon kernel: drivers/usb/class/acm-FOMA.c: acm_control_msg: rq: 0x20 val: 0x0 len: 0x7 result: -32
Apr 27 22:29:50 epicon kernel: acm_FOMA 2-1:1.4: usb_probe_interface
Apr 27 22:29:50 epicon kernel: acm_FOMA 2-1:1.4: usb_probe_interface - got id
Apr 27 22:29:50 epicon kernel: acm_FOMA 2-1:1.4: no interfaces
Apr 27 22:29:50 epicon kernel: usbcore: registered new interface driver acm_FOMA
Apr 27 22:29:50 epicon kernel: acm_FOMA: v0.26-FOMA.10:USB modems driver for docomo FOMA Cellular phone
Apr 27 22:31:38 epicon kernel: hub 2-0:1.0: state 7 ports 2 chg 0000 evt 0002
Apr 27 22:31:38 epicon kernel: uhci_hcd 0000:02:00.0: port 1 portsc 008a,00
Apr 27 22:31:38 epicon kernel: hub 2-0:1.0: port 1, status 0100, change 0003, 12 Mb/s
Apr 27 22:31:38 epicon kernel: usb 2-1: USB disconnect, address 8
Apr 27 22:31:38 epicon kernel: usb 2-1: unregistering device
Apr 27 22:31:38 epicon kernel: usb 2-1: usb_disable_device nuking all URBs
Apr 27 22:31:38 epicon kernel: usb 2-1: unregistering interface 2-1:1.0
Apr 27 22:31:38 epicon kernel: drivers/usb/class/acm-FOMA.c: Entering stop_data_traffic
Apr 27 22:31:38 epicon kernel: usb 2-1: unregistering interface 2-1:1.1
Apr 27 22:31:38 epicon kernel: usb 2-1: unregistering interface 2-1:1.2
Apr 27 22:31:38 epicon kernel: drivers/usb/class/acm-FOMA.c: Entering stop_data_traffic
Apr 27 22:31:38 epicon kernel: usb 2-1: unregistering interface 2-1:1.3
Apr 27 22:31:38 epicon kernel: usb 2-1: unregistering interface 2-1:1.4
Apr 27 22:31:38 epicon kernel: hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x100
これで、何が分るかは後に続くよ

pepo