![鼠标几秒钟后关闭(Ubuntu 13.10,Windows 8.1)](https://linux22.com/image/851957/%E9%BC%A0%E6%A0%87%E5%87%A0%E7%A7%92%E9%92%9F%E5%90%8E%E5%85%B3%E9%97%AD%EF%BC%88Ubuntu%2013.10%EF%BC%8CWindows%208.1%EF%BC%89.png)
我试过了lsusb
,我可以在列表中看到我的鼠标。
我试过
for foo in /sys/bus/usb/devices/*/power/level;
> do echo on > $foo;
> done
但我收到了这个回复
bash: /sys/bus/usb/devices/1-4/power/level: Permission denied
bash: /sys/bus/usb/devices/2-2/power/level: Permission denied
bash: /sys/bus/usb/devices/5-1/power/level: Permission denied
bash: /sys/bus/usb/devices/5-3/power/level: Permission denied
bash: /sys/bus/usb/devices/usb1/power/level: Permission denied
bash: /sys/bus/usb/devices/usb2/power/level: Permission denied
bash: /sys/bus/usb/devices/usb3/power/level: Permission denied
bash: /sys/bus/usb/devices/usb4/power/level: Permission denied
bash: /sys/bus/usb/devices/usb5/power/level: Permission denied
bash: /sys/bus/usb/devices/usb6/power/level: Permission denied
请注意,只有当我的笔记本电脑拔下电源时才会发生这种情况。
答案1
你的代码应该是,
for i in /sys/bus/usb/devices/*/power/level; do sudo echo on > $i; done
或者
for i in /sys/bus/usb/devices/*/power/level; do sudo sh -c "echo on > $i"; done