forked from giuse/asus-xonar-u1-utils
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path16-asus-xonar-u1.sh
executable file
·34 lines (32 loc) · 940 Bytes
/
16-asus-xonar-u1.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
#Asus Xonar U1 does not preserve the configuration on hibernate
#We will manully unbind the usbhid driver from the device and
#bind it again on thaw, so that udev can pick up the event and spawn
#a new xonard instance
case "$1" in
hibernate)
#Remove any stale temporary file
rm -f -- /tmp/asus-xonar-u1-devices
#Unbind Xonar U1 devices and store their IDs
for dev in /sys/bus/usb/drivers/usbhid/[0-9]*
do
if [ -d $dev/0003:0B05:1743.* ]
then
devname=`basename $dev`;
echo "$devname" >> /tmp/asus-xonar-u1-devices
echo "$devname" > /sys/bus/usb/drivers/usbhid/unbind
fi
done
;;
thaw)
#Rebind stored Xonar U1 devices
for devname in `cat /tmp/asus-xonar-u1-devices`
do
echo "$devname" > /sys/bus/usb/drivers/usbhid/bind
done
#Remove the temporary file
rm -f -- /tmp/asus-xonar-u1-devices
;;
*) exit $NA
;;
esac