USB IR Toy record and playback application

From DP

Jump to: navigation , search

Contents

Description

This utility records data coming from the USB Infrared Toy. It can also playback recorded files, including two very simple macro playback modes. The IR Sampling mode of the USB IR Toy is used so a fairly recent version of the USB IR Toy firmware is required. In order to play back recorded signals firmware v07 is the minimum that can be used.

Current Version

IR TOY Recorder/Player utility v20 (CC-0)
http://dangerousprototypes.com

How to Use

Connect the IR Toy.

Run the batch file included in this utility with properly edited parameters.

Press a button on a remote control.

Usage

  irtoy  -d device [-s speed]
  Example Usage:   irtoy  -d COM1 -s speed -f outputfile  -r -p
          Where: -d device is port e.g.  COM1  
                 -s Speed is port Speed  default is 115200 
                 -f Output/input file is a base filename for recording/playing pulses  
                 -r Record into a file indicated in -f parameter (requires -f) 
                 -p Play the file/sequence of file indicated in -f parameter (requires -f 
                 -n Output and convert codes to other resulutions  (default is 21.33us)
                    (requires -f) 
                 -q Play command files listed in the file indicated in -f parameter (requires -f )
                 -a Optional automatic play (does not wait for keypress). 
                    You must specify delay in milliseconds between sending 
                    each command.
                 -v Display verbose output, have to specify level 0, 1 etc,
                    although at present it is only on or off :).
                 -b buffersize. Sets the buffer size, default is 256. Use inputs in multiple of 16.
                       e.g. 16,32,64, 128, 256 and so on. Use to finetune playback buffer size
                 -o Create OLS file based on the filename format  ext. "ols" (Requires -f)  
                 -t Create or Play text files based on the filename format ext. "txt" (Requires -f)  
          Sample Valid commandline parameters:
              irtoy -d COM3 -p -f test -r   -->record to file test and play after, use default speed.
              irtoy -d com3 -p -f test      -->play the test file
              irtoy -d com3 -r -f test      -->record to "test" file.
              irtoy -d com3 -p -a 500 -f sanyo
              irtoy -d com3 -q -f macrodvd.txt
              irtoy -d com3 -p -f test -o    --> play test*.* and create corresponding OLS file.
          NOTES:
            1. test will generate a sequence of this format:  test_000.bin to  test_nnn.bin where nnn <=999
            This Will definitely OVERWRITE sequence of this file with the same basename.
            2. Filename for -p -f is only a prefix to which nnn.bin is added, and for the -q -f the file name is the full name of the file.
            3. -q command file is a simple text file:
        Note the file names can be random, ie the numbered sequential rule does not apply.
         Sample file content:
            sanyo_000.bin
            sanyo_010.bin
            sanyo_020.bin
            sanyo_500.bin

         Files can be in a subdirectory if use the following syntax:
            .\\dvd\\sanyo_000.bin
            .\\dvd\\sanyo_010.bin
            .\\dvd\\sanyo_020.bin
            .\\dvd\\sanyo_500.bin

    • In Linux, use /dev/ttySx instead for COMx port.

Sample Output

E:\>irtoy -d COM4 -p -f test -r
-------------------------------------------------------------------------
IR TOY Recorder/Player utility v0.2 (CC-0)
http://dangerousprototypes.com
-------------------------------------------------------------------------
Opening IR Toy on COM4 at 115200bps...
Entering IR sample mode ....
IR Toy Protocol version: S 0 1
Recording started.....
Press a button on the remote.
Waiting..any key to exit..
Creating file: test_000.bin
IR Toy said:
00 2B 00 27 00 54 00 51 00 2A 00 27 00 2C 00 27 00 2A 00 27
00 54 00 51 00 2C 00 27 00 54 00 51 00 54 00 51 00 2A
IR Toy said:
FF FF
writing test_000.bin
Waiting..any key to exit..
Creating file: test_001.bin
IR Toy said:
00 2B 00 27 00 2A 00 27 00 2B 00 27 00 2A 00 27 00 2B 00 27
00 2A 00 27 00 54 00 51 00 2B 00 27 00 54 00 51 00 54 00 51
00 2A
IR Toy said:
FF FF
writing test_001.bin
Waiting..any key to exit..
Creating file: test_002.bin
IR Toy said:
00 2C 00 27 00 54 00 51 00 2A 00 27 00 2B 00 27 00 2A 00 27
00 54 00 27 00 2C 00 27 00 2A 00 27 00 2B 00 27 00 2A 00 27
00 2B 00 51 00 2A
IR Toy said:
FF FF
writing test_002.bin

Standard output.

Waiting..any key to exit..
Creating file: test_003.bin
IR Toy said:
00 2C 00 27 00 2A 00 27 00 2B 00 27 00 2A 00 27 00 2C 00 27
00 2A 00 27 00 54 00 27 00 2B 00 27 00 2A 00 27 00 2C 00 27
00 2A 00 51 00 54
IR Toy said:
65 94 00 2C 00 27 00 54 00 51 00 2A 00 27 00 2C 00 27 00 2A
00 27 00 54 00 27 00 2D 00 26 00 2A 00 27 00 2C 00 27 00 2A
00 51 00 54
IR Toy said:
10 9C 00 2C 00 27 00 54 00 51 00 2A 00 27 00 2D 00 26 00 2A
00 27 00 54 00 27 00 2C 00 27 00 2A 00 27 00 2C 00 27 00 2A
00 51 00 55
IR Toy said:
FF FF
writing test_003.bin
Waiting..any key to exit..

A button held too long will repeat.

What it Does

This little app is based on the IR Toy sampling mode.

Program flow (recording):

  1. Initialize the port
  2. Initialize the IR Toy:
    1. Send 0x00 five times to make sure that its out of sump mode
    2. Enter the IR sample mode by sending the command 'S'. It should reply with the version (S01)
  3. Press a remote button and bytes will start to flowing into the port
  4. It will create a sequence files starting from _000 and incrementing each time it receives the data terminator (0xFF 0xFF)
  5. Press anykey to end recording

Program flow (playback):

  1. If the -p is included in the commandline parameter, it will replay back the file in the -f filename starting from the 000 up to 999.
  2. Hit anykey to start playing each file, an X will exit the sequence play and exit.


Added Feature

By adding -o at the command parameter, this IRTOY utility will output a logic sniffer compatible file *.ols

Its is now able to capture a continuous stream of data from the IRTOY.

Downloads

Download the source and executable:

Compiling the source

This utility was created using Code::Blocks 10.05 with default settings. It compiles and was tested on Windows. Version 0.8 compiles without complain on Debian 5, and still untested. Version 0.81 has not been compiled on LINUX but will hopefully do so OK, or require only a minor change to the Sleep command.