Difference between revisions of "Loader:CWiid Daemon Alternative"

From Wah!ki
Jump to navigation Jump to search
(Created page with "#!/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-...")
 
Line 1: Line 1:
 +
<pre>
 
#!/bin/bash
 
#!/bin/bash
  
Line 22: Line 23:
 
MAC_ADDRESS=$REPLY
 
MAC_ADDRESS=$REPLY
 
echo $MAC_ADDRESS > wiimote-mac
 
echo $MAC_ADDRESS > wiimote-mac
 +
</pre>

Revision as of 10:58, 18 January 2011

#!/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