Friday, September 30, 2011

Perl code for Light Strike decoding

Making progress on my quest to write a 'capture the flag' module for the light strike laser tag guns. Some googling found me this code from Kenneth L. Root. <http://the-b.org>. I hacked it into this the other day and am able to get this output now:




root@rwhiffen-OptiPlex-GX280:/tmp# ./light-strike.pl
Opening port: /dev/ttyUSB0
Opened port /dev/ttyUSB0
Shoot the gun at the IR Sensor
IR Code: 0xe6 0xc2 0x87 0x0d 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x40 0x12 0x40 0x12 0x40 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x3f 0x12 0x0e 0x12 0x40 0x12 0x0f 0x11 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x3f 0x12 0x0e 0x12 0xff
root@rwhiffen-OptiPlex-GX280:/tmp# ./light-strike.pl
Opening port: /dev/ttyUSB0
Opened port /dev/ttyUSB0
Shoot the gun at the IR Sensor
IR Code: 0xb9 0xc2 0x86 0x0e 0x11 0x0f 0x11 0x0f 0x11 0x0e 0x12 0x0e 0x12 0x40 0x12 0x3f 0x12 0x40 0x12 0x0e 0x12 0x0f 0x11 0x0e 0x11 0x0f 0x11 0x0e 0x12 0x0e 0x11 0x0e 0x12 0x0e 0x11 0x0e 0x12 0x0e 0x12 0x0f 0x11 0x0e 0x12 0x0e 0x12 0x40 0x12 0x0e 0x12 0x3f 0x12 0x0e 0x12 0x0e 0x12 0x0f 0x11 0x0e 0x12 0x0e 0x12 0x0e 0x12 0x40 0x12 0x0e 0x12 0xff
root@rwhiffen-OptiPlex-GX280:/tmp#


So I'm getting closer. The results are more inconsistent with the perl code than with the 'mode2 command, which makes me think I might want to do some 'expect' style perl coding with the app rather than direct. maybe something like:




open(MODE,"|mode2 --driver=usb_uirt_raw --device=/dev/ttyUSB0 --mode");


And then do all my interacting with the output via the MODE file handle. That would allow me to get some basic functionality going.


No comments:

Post a Comment