USBデバイスのリセットなど
WEBカメラが使用できない(使用中?)事が頻発するので、リセットプログラムを用意しておく。
usbreset.c https://gist.github.com/x2q/5124616
を使う。
# gcc usbreset.c -o usbreset # chmod +x usbreset
使い方は
# ./usbreset /dev/bus/usb/001/017
などになる。
usbデバイスのバス番号等を調べる。
$ lsusb Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 008: ID 0424:ec00 Standard Microsystems Corp. Bus 001 Device 017: ID 046d:0994 Logitech, Inc. QuickCam Orbit/Sphere AF Bus 001 Device 009: ID 0461:4d81 Primax Electronics, Ltd Bus 001 Device 010: ID 413c:2107 Dell Computer Corp.
今回は、Logitech, Inc. QuickCam Orbit/Sphere AF を対象にしたいので、なんとかして、 017 を得る。
$ lsusb | grep '046d:0994' | tail -1 | cut --delimiter=' ' --fields='4' | tr --delete ':' 017
ということで、シェルスクリプトにしおく。
#!/bin/sh BUS=`lsusb | grep '046d:0994' | tail -1 | cut --delimiter=' ' --fields='2'` DEV=`lsusb | grep '046d:0994' | tail -1 | cut --delimiter=' ' --fields='4' | tr --delete ':'` PATH="/dev/bus/usb/${BUS}/${DEV}" echo $PATH /usr/bin/sudo ./usbreset $PATH
WIFIのパワーマネジメントをOFFにする
# cat /sys/module/8192cu/parameters/rtw_power_mgnt 1
なので、
/etc/modprobe.d/8192cu.conf
を作成して、
# Disable power saving options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1
rtw_power_mgnt=0|1|2 0 == disable power saving 1 == power saving on, minPS 2 == power saving on, maxPS
rtw_enusbss=0|1 0 == disable auto suspend 1 == enable auto suspend
rtw_ips_mode=0|1 0 == low power, IPS_NORMAL 1 == higher power, IPS_LEVEL2
とのこと。