Loader:CWiid Daemon Alternative

From Wah!ki
Revision as of 10:58, 18 January 2011 by Sairuk (talk | contribs)
Jump to navigation Jump to search
#!/bin/bash

$Wiimote_Keymap = ir_wahcade

# wiimote-mac is the name of the file with the mac address

if [ -f wiimote-mac ]; then # if file exists
    MAC_ADDRESS=$(cat wiimote-mac) # load mac address into the variable

    if [ ! -z "$MAC_ADDRESS" ]; then # if variable not empty
        echo "We already have a mac address configured: $MAC_ADDRESS"
        # run commands here
   wminput -d -c $Wiimote_Keymap $MAC_ADDRESS
        exit
    fi
fi

# We only fall here if the mac address is not configured...
# Configure the mac address, assign it to $MAC_ADDRESS and then store it inside
# the file
wminput -c $Wiimote_Keymap
MAC_ADDRESS=$REPLY
echo $MAC_ADDRESS > wiimote-mac