| View previous topic :: View next topic |
| Author |
Message |
agheno
Joined: 14 Dec 2008 Posts: 4
|
Posted: Mon Dec 15, 2008 3:32 am Post subject: HDHR IR Receiver + WinLIRC + Virtual Serial Port |
|
|
I'm not really sure what question to ask so I'll start with: How does LIRC interpret the IR data from HDHR?
I read in the MythTV intructions that the IR reciever can be used under linux with the LIRC application. A port of LIRC exists for windows but it lacks the ability to receive IR signals from a UDP source like the original LIRC application. My workaround for this is to use a program called HW VSP3 to configure a bridge between a TCP connection and a virtual serial port which WinLIRC can read from. I am also using two netcat sessions to tunnel between HDHR's UDP output stream and HW VSP3's TCP input stream. WinLIRC attaches to the virtual device on COM3.
The data flow is basically works like this:
HDHR (output to UDP 5000) -> [ netcat (listen on UDP 5000) -> netcat (output to TCP 5000) ] -> HW VSP3 (listen on TCP 5000, output to COM3) -> WinLIRC (listening to COM3)
I have verified with hyperterminal connected to COM3 that data is flowing from the HDHR to my virtual serial port (com3) when I press a button on any of my remotes. Under WinLIRC I had to set the receiver type to RX instead of DCD -- I'm not really sure what the difference is but with DCD selected I do not get any information from the 'Raw Codes' window. Chaning the Baud rate and Virtual pulse doesn't seem to make a difference but for now I have them set to 9600 baud and 300 pulse. With the 'Raw Codes' window open, I press a button on my remote for a few seconds and get output similar to this:
| Code: | Outputting raw mode2 data.
space 42016741
pulse 300
pulse -16777275 11111111 11000101 32709 on
pulse 300
space 48856
pulse 300
pulse -16777283 11111111 10111101 32701 on
pulse 300
space 12508
pulse 300
pulse -16777282 1111111110111110 32702
pulse 300
space 64238
pulse 300
pulse -16777276
pulse 300 |
WinLIRC appears to be reading/parsing the IR codes, but when I try to use the Learn function to record the IR codes for each key it gives errors.
| Code: | Step One: Determine signal gap, signal length, and repeat codes.
------------------------------------------------------------------------------------------------------------------------
You will be asked to press an arbitrary button a number of times.
Please hold it in for at least one second each time, and wait at
least one second between keypresses.
If you want to manually enter a signal gap and signal length, you
may do so now (ie, "31000 52"). Otherwise, just hit ENTER.
Gap and length?
Press a button.
Please wait a second and press it again.
Error reading signal; please try again.
Error reading signal; please try again.
Error reading signal; please try again.
Did not get a consistent signal; please try again.
Did not get a consistent signal; please try again.
Error reading signal; please try again.
Did not get a consistent signal; please try again.
Did not get a consistent signal; please try again. |
Since I am not familiar with LIRC or WinLIRC, does anyone know where I should begin in troubleshooting this problem?
(edit to provide a link to the virtual serial port software) |
|
| Back to top |
|
 |
jhaglund
Joined: 30 Oct 2008 Posts: 5
|
Posted: Mon Jan 12, 2009 12:13 am Post subject: |
|
|
| I am attempting to get this working with EventGhost (eventghost.org). How, and what commands are you issuing to netcat? |
|
| Back to top |
|
 |
cncb
Joined: 14 Jul 2009 Posts: 10
|
Posted: Wed Oct 07, 2009 8:09 pm Post subject: |
|
|
| Ugh. It's almost like the infrared receiver is not meant to work with Windows. I took a slightly different approach (wrote a program that sends the UDP data directly to a virtual COM port) but I'm running into the exact same problem. I don't suppose you ever were able to figure this out (or ever visited the forums again)? |
|
| Back to top |
|
 |
agheno
Joined: 14 Dec 2008 Posts: 4
|
Posted: Tue Dec 01, 2009 7:49 pm Post subject: |
|
|
cncb: I ended up getting side tracked on other projects so I didn't make any real progress with the HDHR IR receiver under windows. Some time after that, a friend of mine gave me a WMC IR receiver that he received at a tradeshow so I just used that instead.
I have to say that the core functionality of tuning ASTC channels is what I purchased the HDHR for and it works perfectly. Although the IR interface would have been a nice bonus, I still would have purchased the HDHR even without it. With that said, I really wonder why SiliconDust would go through the effort to engineer the hardware to include the IR input but not write the actual drivers to take advantage of it on the most common platforms. It seems like with all the parts in place to make it happen, it was arbitrarily left incomplete.
I hope my comment does not get taken as a negative complaint against the SiliconDust developers -- they delivered on what is important and that's all that really matters to me. |
|
| Back to top |
|
 |
jimparis
Joined: 11 Dec 2009 Posts: 4
|
Posted: Fri Dec 11, 2009 6:34 pm Post subject: |
|
|
| Forwarding the UDP data to a virtual com port won't work -- when WinLIRC uses a serial port, it's not using it to transfer byte-oriented data, but watching the DCD or RX line to determine timing information "manually". You would need to modify the WinLIRC code with something similar to the hw_udp driver in LIRC. It wouldn't be very hard -- basically modify irdriver.cpp to support listening on a UDP port, and every time a packet is received, call SetData and SetEvent with the received data as appropriate. |
|
| Back to top |
|
 |
jimparis
Joined: 11 Dec 2009 Posts: 4
|
Posted: Fri Dec 11, 2009 6:36 pm Post subject: |
|
|
| Alternately, it would probably not be difficult to compile and run LIRC in Windows with either cygwin or msys. The hw_udp driver is basically just POSIX so it should work fine. Your apps could then connect to the LIRC server instead of the WinLIRC server to receive button presses. |
|
| Back to top |
|
 |
cncb
Joined: 14 Jul 2009 Posts: 10
|
Posted: Fri Dec 11, 2009 6:57 pm Post subject: |
|
|
| jimparis wrote: | | You would need to modify the WinLIRC code with something similar to the hw_udp driver in LIRC. It wouldn't be very hard -- basically modify irdriver.cpp to support listening on a UDP port, and every time a packet is received, call SetData and SetEvent with the received data as appropriate. |
That sounds great. Are you one of the WnLIRC developers listed on the website by the same name? If so, any chance you could add this for us? Pretty please? I think it would make a lot people happy to finally be able to use the HDHR infrared receiver in Windows. |
|
| Back to top |
|
 |
cncb
Joined: 14 Jul 2009 Posts: 10
|
Posted: Tue Jan 05, 2010 9:13 pm Post subject: |
|
|
| cncb wrote: | | That sounds great. Are you one of the WinLIRC developers listed on the website by the same name? If so, any chance you could add this for us? Pretty please? I think it would make a lot people happy to finally be able to use the HDHR infrared receiver in Windows. |
I am not equipped to program in Visual C++ or I would try it myself. Can anyone out there do this for us? Thanks. |
|
| Back to top |
|
 |
jimparis
Joined: 11 Dec 2009 Posts: 4
|
Posted: Wed Jan 20, 2010 7:28 pm Post subject: |
|
|
Yeah, I'm me. As I said in my second post I don't think changing WinLIRC is worth the trouble (I'm also not equipped for it anymore). Just build LIRC with hw_udp in cygwin. I've tested it here and it seems to basically work -- this is rough and only barely tested but it should be enough to get the idea across:
- install cygwin. use the default list of packages and add 'wget', 'gcc4' and 'make'
- load cygwin and get the lirc source
| Code: | | wget http://prdownloads.sourceforge.net/lirc/lirc-0.8.6.tar.bz2 |
unpack and build lirc
| Code: | tar xvf lirc-0.8.6.tar.bz2
cd lirc-0.8.6
./configure --with-driver=udp --disable-daemonize
make | (ignore the errors when building lircmd.exe; the required irrecord and lircd executables should have already been built successfully)
record your remote
| Code: | cd daemons
./irrecord.exe ~/myremote.conf
|
then run lircd with that new config
| Code: | ./lircd.exe --pidfile=/tmp/pid --output=/tmp/socket --listen ~/myremote.conf
|
now it should be listening on TCP port 8765 just like WinLIRC would.
|
|
| Back to top |
|
 |
cncb
Joined: 14 Jul 2009 Posts: 10
|
Posted: Thu Jan 21, 2010 9:17 pm Post subject: Success! |
|
|
Thank you very much, Jim! I never would have figured this out on my own. I have only done limited testing but it seems to be working great. The only slight deviation from Jim's instructions are that you need to add the "-H udp -d 5000" options to the irrecord.exe and lircd.exe commands (where 5000 is the port number as described in the HDHR Myth setup instructions).
This is probably obvious to Linux users but is there a way to run the "lircd.exe" command when starting up cygwin so that just a shortcut to cygwin in Windows will get everything running properly? Thanks. |
|
| Back to top |
|
 |
jimparis
Joined: 11 Dec 2009 Posts: 4
|
Posted: Thu Jan 21, 2010 10:02 pm Post subject: |
|
|
You can set up a normal Windows shortcut with a location of:
| Code: | | C:\cygwin\bin\bash.exe -c "~/lirc-0.8.6/daemons/lircd.exe --pidfile=/tmp/pid --output=/tmp/socket --listen -H udp -d 5000 ~/myremote.conf" | (all one line)
If you set the shortcut to start minimized, it's mostly out of the way, too. |
|
| Back to top |
|
 |
NeoMatrixJR
Joined: 12 Aug 2010 Posts: 2
|
Posted: Thu Aug 12, 2010 10:52 pm Post subject: What Apps? |
|
|
| What should this work with? Can I use it to pipe commands to Win7 MCE? How can I test to see if it's receiving anything? I can't seem to find the irw command. |
|
| Back to top |
|
 |
|