Loader:CWiid Daemon Alternative
Jump to navigation
Jump to search
#!/bin/bash wii_keymap="ir_wahcade" file=$HOME/.wahcade/wiimote-mac declare -a bd_address # wiimote-mac is the name of the file with the mac address # search wiimotes with hcitool zenity --info --title "Wiimote Pairing" --text "Getting Wiimote Address." --timeout 5 & if [[ -f $file ]]; then # if file exists IFS=$'\n' read -r -d '' -a bd_address < $file while read -r bd_address; do wminput -d -c "$wii_keymap" "$bd_address" & printf '%s\n' "$bd_address" >> "$file" || break done < <(comm -23 <(hcitool scan|awk '/Nintendo/{print $1}'|sort -u) <(sort -u "$file")) else # Only Write to the configuration file if there is a Wiimote Address aquired if [[ -n "$bd_address" ]]; then printf '%s\n' "${bd_address[@]}" > $file fi #if no Wiimote is found, exit with an error if test ${#bd_address[*]} -eq 0; then zenity --info --title "Wiimote Pairing" --text "No wiimotes found." --timeout 5 & exit 0 fi fi # killing wminput -d instances killall -q wminput # start wminput for each macaddress zenity --info --title "Wiimote Pairing" --text "Put the ${#bd_address[*]} Wiimotes in Discovery Mode." --timeout 5 & for m in "${bd_address[@]}"; do wminput -d -c $wii_keymap $m & done