I have an problem with my system where the mouse periodically fails and takes out everything connected to the same USB hub. I have a "fix", which is to run the following code to restart the USB system:
[code]
#!/bin/sh
# Find the optical mouse USB item in the list of buses:
bus=`lsusb | grep 'Optical Mouse' | cut -f 2 -d ' '`
# get the device name for the hub hosting the mouse
devname=`lsusb -v -s ${bus}:1 | grep iSerial | awk '{print $3}'`
# reset the hub for usb 2.0 devices. (Note: use ohci-pci for USB 1.1)
echo $devname > /sys/bus/pci/drivers/ehci-pci/unbind
echo $devname > /sys/bus/pci/drivers/ehci-pci/bind
[code]
This works, but has a troublesome side effect. After doing this, the sound system doesn't work. The sound system is not a USB system.
Runing "aplay -l" gives the message: "aplay: device_list:268: no soundcards found...".
The weird thing is that if I hit ctrl-alt-F1 to get a console and log in as a normal user, the sound (that was not working in X) starts playing and "aplay -l" lists
Code:
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
Subdevices: 0/1
Subdevice #0: subdevice #0
One other observation is that if I run 'aplay -l' as root from within X then I get the same list, and in fact "aplay file.wav" works if I run it as root. So somehow my resetting command is changing permissions of something so that only root can run sound while I'm within X...but outside of X the sound works for the regular user.
How can I reset the USB system without messing up the sound? How can I fix the permissions after having run the above so that sound works properly?