LIRC patch for USB-UIRT support

Interested in integrating USB-UIRT support into an application? Look here!

Moderator: jrhees

LIRC patch for USB-UIRT support

Postby kRutOn » Mon Aug 09, 2004 8:02 pm

I stayed up all night working on trying to get the transmit functionality to work with my DISH Network equipment without success. However, receive seems to work well; probably because it hasn't changed much between the UIRT2 and USB-UIRT.

This is the first release of the patch I have made and it's to be considered alpha quality right now. So don't run any critical devices from it.

http://www.the-b.org/~kenny/patches/lirc-0.7.0pre7-usbuirt0.1a.patch.gz
kRutOn
 
Posts: 4
Joined: Mon Aug 09, 2004 8:43 am
Location: Kansas, USA

Postby Guest » Tue Aug 10, 2004 10:10 pm

I wish I knew how to help but I'm not much of a coder, just wanted to say Thanks.

Very interested to get it work with DN reciever too and have it running on Linux instead of Windows. Will try the patch in next few days, hopefully... Thanks again.
Guest
 

Postby Guest » Tue Sep 07, 2004 2:20 pm

kRutOn,

Good to see some progress on a LIRC plugin by someone at last.

I'm just trying to get the receive parts working for now, but one comment, it may be better to put the USB-UIRT option under USB devices (option 8 in lirc setup), than under serial devices. I, at least, would expect it to be listed as a usb device, rather than a serial device.

Perhaps this isn't technically possible though.

Thanks
Peter
Guest
 

Postby peter » Wed Sep 08, 2004 1:32 pm

All,

Since the patch posted above seems to work well for me (when receiving IR at least), and since there seems to be no other way to use the USB-UIRT under linux for MythTV I've put together some instructions which may help others using the above patch.

I hope this helps someone.
Peter

NB: these instructions cover the steps I took, if they help you fine and good, if not, then I accept no responsibility.


HOW-TO use your USB-UIRT with LIRC

This is based on FC2 and using apt-get from atrpms.net. I have used the patch, devised & posted above by Kenny. I don’t really understand how it works, but it does seem to work well for receiving IR commands and learning new remotes (I don’t, yet, have a need for IR transmit on my Linux machine).

The Linux kernel 2.6.8 includes all drivers for the USB-UIRT, after plugging it in to the USB port, check ‘# dmesg’ output, and you should see something similar to;

ftdi_sio 5-1:1.0: USB-UIRT Infrared Tranceiver converter detected
usb 5-1: USB-UIRT Infrared Tranceiver converter now attached to ttyUSB0
usbcore: registered new driver ftdi_sio

You need to install (& patch) LIRC for the USB-UIRT to be useable in MythTV, www.mythtv.org (well, that’s what I want to use it for). Install the following packages from FC2 / iso images (http://download.fedora.redhat.com/pub/f ... dora/RPMS/ ). I used;
automake-1.8.5
autoconf-2.59.3
libtool-1.5.6-1

Download gcc/ c++ stuff needed by LIRC during compile time (LIRC compile failed with a lib/cpp sanity check error, this fixed it);

# apt-get install gcc-c++
Download lirc-0.7.0pre7.tar.bz2 to /home/mythtv
Untar (tar –jxvf lirc-0.7.0pre7.tar.bz2)
# mv /home/mythtv/lirc* /usr/src/.
Apply USB-UIRT patch (downloaded from www.usbuirt.com support forum or
http://www.the-b.org/~kenny/patches/lir ... a.patch.gz)
# cd /usr/src/lirc-0.7.0pre7
# patch –p1 < /home/mythtv/lirc-0.7.0pre7-usbuirt0.1a.patch
# ./setup.sh (choose usb-uirt under serial devices)
# make
# make install
Change rights on /dev/lircd (as per LIRC documentation at www.lirc.org)
# chmod 666 /dev/lircd

Use ‘irrecord –f <filename>’ to compile a lircd.conf file to map remote IR commands to keys. Copy created file to /etc/lircd.conf

Create /dev/lirc
I believe LIRC should create this device/link during install time, but appears not to for USB-UIRT. Therefore create it manually (review dmesg output to check ttyUSB0 is correct)
# ln -sf ttyUSB0 /dev/lirc

Start up LIRCD
/usr/local/sbin/lircd
Use ‘irw’ to test all buttons on remote (review console output for results)

NB: It appears that USB-UIRT doesn’t need any kernel modules.

Get LIRC to start automatically;

# cd /etc/rc.d
# cat >> rc.local
echo "Starting lircd"
/usr/local/sbin/lircd
^D
#
peter
 
Posts: 3
Joined: Wed Sep 08, 2004 1:26 pm

Postby neveld » Thu Sep 09, 2004 6:19 pm

Hi,
I thought I'd toss my hat into the ring here and announce that I too have a patch for LIRC. Receive and transmit seem to work. I also added the "extended raw" command, and modified irrecord to use it. The patch and some instructions can be found here. I would be interested in hearing people's results.

Better two solutions than none, I suppose :)
neveld
 
Posts: 7
Joined: Mon Aug 30, 2004 3:55 pm

Postby peter » Thu Sep 16, 2004 8:28 am

neveld,

I've been trying your patch, and it seems to work well for receiving IR. I've also been trying to get it working for transmitting IR, but with no joy.

Basic steps;

configure LIRC to use USB-UIRT with receive and transmit
install LIRC
start /usr/local/sbin/lircd
learn codes to be transmitted by using irrecord -l option, I get;

begin remote

name dvd
flags CONST_LENGTH|RAW_CODES
eps 30
aeps 100

ptrail 0
repeat 0 0
gap 44887

begin raw_codes

name pwr
# frequency 40283
2408 589 1207 589 607 590
1207 589 607 590 1207 589
607 590 607 589 607 591
1205 591 607 590 1205 591
1205 591 1205 590 607 591
607 589 1207 590 607 589
607 590 1207 589 607

name open
# frequency 40150
2386 612 586 610 1186 610
1185 611 584 614 1185 610
585 613 584 613 585 611
1183 612 585 612 1183 613
1183 612 1184 613 584 613
585 611 1185 610 586 612
583 613 1184 614 584

end raw_codes

end remote

for 2 buttons I tried.

Then I use 'irsend send_once dvd open', but I get nothing. I'd expect the LED to flicker when sending the IR code (as it does under windows), but i'm not 100% this should be the case.

I see the following in the /var/log/lircd logfile;

Sep 13 19:32:37 mythtv01 lircd 0.7.0pre7: accepted new client on /dev/lircd
Sep 13 19:32:37 mythtv01 lircd 0.7.0pre7: uirt2usb_raw: checksum error
Sep 13 19:32:37 mythtv01 lircd 0.7.0pre7: uirt2usb_raw: UIRT version 0504 ok
Sep 13 19:32:37 mythtv01 lircd 0.7.0pre7: removed client
Sep 13 19:32:43 mythtv01 lircd 0.7.0pre7: accepted new client on /dev/lircd
Sep 13 19:32:44 mythtv01 lircd 0.7.0pre7: uirt2usb_raw: checksum error
Sep 13 19:32:44 mythtv01 lircd 0.7.0pre7: uirt2usb_raw: UIRT version 0504 ok
Sep 13 19:32:44 mythtv01 lircd 0.7.0pre7: removed client
Sep 13 19:32:46 mythtv01 lircd 0.7.0pre7: accepted new client on /dev/lircd
Sep 13 19:32:47 mythtv01 lircd 0.7.0pre7: uirt2usb_raw: checksum error
Sep 13 19:32:47 mythtv01 lircd 0.7.0pre7: uirt2usb_raw: UIRT version 0504 ok
Sep 13 19:32:47 mythtv01 lircd 0.7.0pre7: removed client
Sep 13 19:32:55 mythtv01 lircd 0.7.0pre7: accepted new client on /dev/lircd
Sep 13 19:32:55 mythtv01 lircd 0.7.0pre7: uirt2usb_raw: checksum error
Sep 13 19:32:55 mythtv01 lircd 0.7.0pre7: uirt2usb_raw: UIRT version 0504 ok
Sep 13 19:32:55 mythtv01 lircd 0.7.0pre7: removed client


but am not sure if this is really related to IR transmitting.


Any ideas? Maybe I just haven't learnt the codes properly.

I'm going to try with another device/remote in case there is just something about this device (a Sony DVD player) which the USB_UIRT & lirc patch won't work with.

Thanks
Peter
peter
 
Posts: 3
Joined: Wed Sep 08, 2004 1:26 pm

Postby neveld » Fri Sep 17, 2004 4:19 pm

Hi peter,
The red LED should flash when the UIRT is transmitting, so something isn't right. When I first started fiddling with the driver, I wasn't having any luck transmitting until I hooked up an external emitter. I did the rest of the driver update using the extenal emitter, thinking I had a bad unit. Unfortunately, I just got a replacement unit from John, and it has the exact same problem - no output with the internal emitter, but works fine if you plug in an external emitter. In all cases though, the red LED would flash, as if it were trying to work.

I suspect there is some sort of initialization problem which may take a while to track down. I do appreciate your trying out the driver, though!
neveld
 
Posts: 7
Joined: Mon Aug 30, 2004 3:55 pm

Postby jrhees » Fri Sep 17, 2004 5:00 pm

neveld,

Guess what! When I sent you out a replacement unit I didn't realize that you were not running the standard Windows USB-UIRT drivers with the API. I think the reason the built-in emitter isn't working for you has to do with the FTDI port setup!

The DTR signal is used to 'Gate Off' the front emitter on newer multi-zone capable units. So, make sure the FTDI port setup does not enable DTR!

-Jon
jrhees
Site Admin
 
Posts: 1652
Joined: Tue Jan 28, 2003 11:49 pm

Postby neveld » Fri Sep 17, 2004 8:15 pm

Ooooh! Thanks for the hint! That should keep me busy for a few days :)
neveld
 
Posts: 7
Joined: Mon Aug 30, 2004 3:55 pm

Postby neveld » Sat Sep 18, 2004 2:29 am

Or not :D After some quick hacking, I can confirm this seems to work. I hope to put up a revised patch sometime tomorrow.
neveld
 
Posts: 7
Joined: Mon Aug 30, 2004 3:55 pm

Postby neveld » Sat Sep 18, 2004 5:41 pm

A new patch with DTR fixes has been put up here.

A note to peter:
Try adding the line:

frequency 40000

right after the 'gap 44887' line in your config file. I've added a note
about doing this in the instructions on my website.
neveld
 
Posts: 7
Joined: Mon Aug 30, 2004 3:55 pm

Great Work please help!

Postby ely_az » Sat Sep 18, 2004 8:36 pm

First of all thank you for all your work on this.

I am having a little trouble but am close. I followed your directions (neveld) and dmesg shows USBUIRT is ok. I compiled lirc with the USB /dev/ttyUSB0 option and everything worked fine. When I run irrecord -l <file> I get nothing. No lights and irrecord times out. If I run irrecord -d /dev/ttyUSB0 everything works fine and I am able to create an lircd.conf file with raw codes. However, when I run irw I get nothing on the screen but the lights blink when pushing buttons. Not sure what is going wrong but I would like to get this working.

dmesg reports
usb.c: registered new driver serial
usbserial.c: USB Serial support registered for Generic
usbserial.c: USB Serial Driver core v1.4
usbserial.c: USB Serial support registered for FTDI SIO
usbserial.c: USB Serial support registered for FTDI 8U232AM Compatible
usbserial.c: USB Serial support registered for FTDI FT232BM Compatible
usbserial.c: USB Serial support registered for USB-UIRT Infrared Receiver/Transmitter
usbserial.c: USB-UIRT Infrared Receiver/Transmitter converter detected
usbserial.c: USB-UIRT Infrared Receiver/Transmitter converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
usbserial.c: USB Serial support registered for Home-Electronics TIRA-1 IR Transceiver
ftdi_sio.c: v1.3.4:USB FTDI Serial Converters Driver
usb_control/bulk_msg: timeout

/var/log/lirc reports
Sep 18 13:22:47 localhost.localdomain lircd 0.7.0pre7: accepted new client on /dev/lircd
Sep 18 13:22:48 localhost.localdomain lircd 0.7.0pre7: uirt2usb_raw: checksum error
Sep 18 13:22:48 localhost.localdomain lircd 0.7.0pre7: uirt2usb_raw: UIRT version 0504 ok
Sep 18 13:22:55 localhost.localdomain lircd 0.7.0pre7: removed client

I don't know if the checksum error is normal or not. Please help if you have any ideas.
ely_az
 

Almost there

Postby ely_az » Sat Sep 18, 2004 11:02 pm

I think I am in the same boat as Peter. I have gotten the USB-UIRT to receive fine but no transmit. It does appear to be doing something as the irsend command makes the front light blink but does not send correct signals. Hooking up a standard LED to the external port also blinks so signal is being sent but no receive on either my cable box or DVD player. I have tried multiple remotes/devices as well as 3 different IR diodes on the external transmitter. Both of my devices appear to be 36.9KHz but no frequency settings in lircd.conf seem to help. I am still getting errors from lircd log.

Sep 18 15:50:38 localhost.localdomain lircd 0.7.0pre7: lircd(usb-uirt2_raw) ready
Sep 18 15:50:55 localhost.localdomain lircd 0.7.0pre7: accepted new client on /dev/lircd
Sep 18 15:50:56 localhost.localdomain lircd 0.7.0pre7: uirt2usb_raw: checksum error
Sep 18 15:50:56 localhost.localdomain lircd 0.7.0pre7: uirt2usb_raw: UIRT version 0504 ok
Sep 18 15:50:56 localhost.localdomain lircd 0.7.0pre7: removed client

Please Help, I am out of ideas!
ely_az
 

Postby neveld » Mon Sep 20, 2004 6:40 pm

Hi ely_az,
The problem with irrecord -l sounds like you were holding the remote too far away from the USB-UIRT. The range in learning mode is only 1 to 2 inches.

The 'checksum error' message can be ignored (sloppy coding :) )

If neither the internal or external transmitters work, then I'm at a loss, also. Make sure you're using the latest patch. You might also try looking in the 'remotes' directory of the LIRC source tree, or on the LIRC website for a pre-defined configuration for your device. If one is available, try it instead of the one produced by irrecord. If that works, then we could see what is different about the two configs.
neveld
 
Posts: 7
Joined: Mon Aug 30, 2004 3:55 pm

Postby peter » Tue Sep 21, 2004 1:22 pm

neveld,

Yes, the frequency line worked a treat. I can now use the transmitting fuctionality as well as the receiving 8)

But now I am trying to learn the codes of my Denon amp, and am having trouble. Sometimes it learns but often not, and even when it does the transmit doesn't work (well red led lights up, but the amp doesn't respond).

I was going to post the contents of my learnt fiel, but then my h/disk failed so I won't be able to look into this for a while.

Anyway thank you very much for the patch :D

Peter
peter
 
Posts: 3
Joined: Wed Sep 08, 2004 1:26 pm

Next

Return to Developers

Who is online

Users browsing this forum: No registered users and 32 guests

cron