| 11 | | Code follows: |
| 12 | | |
| 13 | | #!/usr/bin/ruby |
| 14 | | |
| 15 | | while true |
| 16 | | if ( m = /(..:..:..:..:..:..).*Nintendo RVL-CNT-01.*/.match %x["/usr/bin/hcitool" scan] ) |
| 17 | | |
| 18 | | # Remove these lines if you aren't using my hacky OSD system |
| 19 | | f = File::open('/tmp/osdd', 'w') |
| 20 | | f.write("Connected Wiimote: #{m[1]}\n") |
| 21 | | f.close |
| 22 | | # End OSD system bit |
| 23 | | |
| 24 | | system "/usr/local/bin/wminput #{m[1]}\n" |
| 25 | | |
| 26 | | # Remove these lines if you aren't using my hacky OSD system |
| 27 | | f = File::open('/tmp/osdd', 'w') |
| 28 | | f.write("Disconnected Wiimote: #{m[1]}\n") |
| 29 | | f.close |
| 30 | | # End OSD system bit |
| 31 | | end |
| 32 | | end |
| | 11 | The script itself, as well as a Gentoo init script to run it, is attached. You may need to edit them, especially if you don't have my OSD system or anything like it (which is quite likely since I have not uploaded it anywhere). |