summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/enableIRWake.sh
blob: 5b971b7fe178f26b8c704ce496cfadda2d13b91c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

for vendProdID in `lsusb | sed -e 's/.*ID \([a-f0-9]\+:[a-f0-9]\+\).*/\1/g'`
do
    foundRemote=`grep -i "$vendProdID" /usr/MythVantage/templates/remotes/receiver_usb.id`
    if [[ $? = 0 ]]
    then
        #echo Found: $foundRemote
        vendID=`echo $vendProdID | cut -d":" -f1`
        prodID=`echo $vendProdID | cut -d":" -f2`
        for usbDevice in `grep . /sys/bus/usb/devices/*/power/wakeup | cut -d"/" -f6`
        do
            foundVendID=`cat /sys/bus/usb/devices/$usbDevice/idVendor`
            foundProdID=`cat /sys/bus/usb/devices/$usbDevice/idProduct`
            if [[ $foundVendID == $vendID && $foundProdID == $prodID ]]
            then
                echo "Enable wake for $foundRemote on $usbDevice"
                sudo sh -c "echo 'enabled' > /sys/bus/usb/devices/$usbDevice/power/wakeup"
            fi
        done
    fi
done