Skip to content
ggodart edited this page Jan 4, 2021 · 1 revision

USB-UIRT

MisterHouse includes support for the USB-UIRT 2 way IR interface, sold by Jon Rees at this web site. Both Windows and *nix are supported with different limitations (see below.)

Setup

To enable the USB_UIRT module, add these entries to your .ini file:

usb_uirt_module=USB_UIRT
usb_uirt_port=/dev/ttyUSB1 # optional, defaults to /dev/ttyUSB0, option not used on Windows
usb_uirt_tx_timeout=X #defaults to 500 ticks. Increase if long codes are being cut off. For example the PS3 'Long PS' command works with 5000 ticks
usb_uirt_rx_timeout=X #defaults to 600 ticks. Can increase is long codes aren't getting recognized.

Windows is supported using the uuirt.DLL driver. If you are on Windows, download it from Jon Rees' USBUIRT website and put it in \windows\system32.

You also need to enable the USB_UIRT_learning.pl script in the common code directory.

Learning

Learning is not yet working on either Windows nor *nix, but can use the USB_UIRT_learning.pl script in the common code directory to import codes found or generated. For example, you can can use Girder or trydrv to learn codes, then import. You can also import pronto codes or use the autogenerate feature in USB_UIRT_learning.pl. To access the USB-UIRT web interface click http://localhost:8080/SUB;usb_uirt_update_html or click on the IR category button.

Transmitting

The USB-UIRT module works with the IR_Item in MisterHouse for transmitting. Use the web interface generated by USB_UIRT_learning.pl to learn, generate, or import codes. Then create your own code file that uses IR_Item to transmit.

$TV = new IR_Item 'SONY TV', 'addEnter', 'usb_uirt';
my $tv_states = 'power,mute,vol+,vol-,ch+,ch-,2,3,4,5,6,7,8,9,11,13,14';

set_states $TV split ',', $tv_states if $Reload;
$v_tv_control = new Voice_Cmd("tv [$tv_states]");

if (($state = said $v_tv_control)) {
  print_log "Setting TV to $state";
  set $TV $state;
}

Receiving

Not implemented on Windows. This module will report incoming infrared signals in the MisterHouse log output. You can use these signal codes to create triggers that can control your MP3 player, DVD software, etc. To use this feature, add lines like these to your code:

$remote = new Serial_Item '190003A0A0E2', 'play';
$remote ->add '190003AEB012', 'stop';

if (my $state = state_now $remote) {
  set $mp3 $state;
}

The Problem with Learning

The problem is different for linux and for windows. On windows, we use the DLL supplied by Jon Rees to talk to the usb-uirt. This simplifies the interface greatly, but requires a callback for learning to work. We haven't been able to get callbacks working, though they should be supported by the Win32 perl modules. I don't use MisterHouse on windows, so I won't be much help.

On linux, we talk directly to the usb-uirt. The learning code is written, but never tested and completed. If you are interested, I can work on this.

Getting IR Codes into MisterHouse

I usually import codes in pronto format. Others use other programs like trydvr to learn codes, then import them into MisterHouse. The easiest way to add devices is by clicking on one of the manufacturers codes listed on the Misterhouse usb-uirt web interface. If those don't work, you need to either learn or import the codes. The best place to find pronto codes is http://www.remotecentral.com/ but you need the ccf2efc program to convert the ccf files into humanly readable text files. I found it at http://www.hifi-remote.com/forums/

The trydrv program is an easy way to learn codes in usb-uirt raw format. Make sure the codes start with R when you import them. You have to send an e-mail to Jon Rees to request the Linux version of trydrv. The Windows equivalent of trydrv is called lrnhelper and is available at the usb-uirt website.

The Problem with Receiving on Windows

Receiving IR signals requires DLL callbacks as well, so it isn't working either. Someone asked about callbacks in perl on the usb-uirt forum a while ago, but got no response. You might try again there or here http://search.cpan.org/dist/Win32-API/Callback.pm

IRP and DVC files

The 2.102 MisterHouse release includes support for IRP and DVC format files. See some examples in data/infrared/devicelib. These are more complicated, but powerful formats developed by the jp1 guys.

Created by David Norwood dnorwood2@yahoo.com

Using udev to hardwire device name

On Linux systems the device file name can vary if you have other USB devices such as USB to serial adaptors or PDAs. This is a problem because MisterHouse won't start if you have configured the usb-uirt port to a device file that has changed. One way around this problem is to use udev to hardwire the device filename associated with the usb-uirt.

Setting up udev is really easy. Here is what I did on a Debian Sarge system:

su
apt-get install udev

vi /etc/udev/rules.d/usb-uirt.rules
BUS=="usb", SYSFS{product}=="USB-UIRT", NAME="usb-uirt"
service udev restart
exit

vi mh.private.ini
usb_uirt_port=/dev/usb-uirt
exit

Then restart MisterHouse.

H. Plato reports that to get udev working on his Fedora Core 5 system, he used this entry in /etc/udev/rules.d/usb-uirt.rules:

KERNEL=="ttyUSB*", SYSFS{product}=="USB-UIRT", SYMLINK+="usb-uirt"

This works for raspbian:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="f850", ATTRS{product}=="USB-UIRT", SYMLINK+="usb-uirt", MODE="0666"
Clone this wiki locally