Version 1 (modified by Heavybell, 6 years ago)

--

This is a simple Ruby script I wrote to handle connecting a wiimote without having to manually run any commands.

At time of writing, you will need the following in order to use this script:

* A modified version of wminput, designed to close when contact with the Wiimote is lost

* Ruby

* My 'good enough for now' OSD system [optional]

Code follows:

#!/usr/bin/ruby

while true

if ( m = /(..:..:..:..:..:..).*Nintendo RVL-CNT-01.*/.match %x["/usr/bin/hcitool" scan] )

# Remove these lines if you aren't using my hacky OSD system f = File::open('/tmp/osdd', 'w') f.write("Connected Wiimote: #{m[1]}\n") f.close # End OSD system bit

system "/usr/local/bin/wminput #{m[1]}\n"

# Remove these lines if you aren't using my hacky OSD system f = File::open('/tmp/osdd', 'w') f.write("Disconnected Wiimote: #{m[1]}\n") f.close # End OSD system bit

end

end

Attachments