Dangerous Prototypes

Dangerous Prototypes => USB Infrared Toy => Topic started by: dukey on July 29, 2010, 05:51:30 pm

Title: WinLIRC driver update
Post by: dukey on July 29, 2010, 05:51:30 pm
I had a bit of time today try and finish this winlirc plugin.. It's not finished yet, some stuff is hard coded, and it has little/no error checking. However .. it actually works.

Heres a capture of the signal using my own graph program (not released this yet).



And heres my winlirc build with extra debug stuff, you can see it's successfully decoding signals for my dvd remote :)

Title: Re: WinLIRC driver update
Post by: dukey on July 30, 2010, 06:15:35 pm


my WinLIRC plugin is finished !
You can download it here:https://sourceforge.net/projects/winlirc/files/Plugins/IR%20Toy/IRToy-1.0.zip/download (http://https://sourceforge.net/projects/winlirc/files/Plugins/IR%20Toy/IRToy-1.0.zip/download)

You will need WinLIRC 0.8.6b.

In order to make WinLIRC to anything useful, you need a config file for your remote control. You can either generate your own config file using IRRecord (which is included in the WinLIRC bundle), or download one from http://lirc.sourceforge.net/remotes/ (http://lirc.sourceforge.net/remotes/)

Then you will need some software to take advantage of WinLIRC. Some programs such as Media Player Classic have winlirc support built straight in, so you can just bind the names of your buttons to actions in MPC :) Or you can just write your own. All you need to do is listen on a socket, and it'll give the name of the button press + repeat count. Other programs such as Eventghost support winlirc and let you do a wide range of stuff on your system.

The graphing tool shown in the screenshot above is available also.

Enjoy :)
Title: Re: WinLIRC driver update
Post by: liyin on July 30, 2010, 09:33:46 pm
I fixed my WinLIRC RC configuration file by replacing the header info with the info from the original file at the LIRC RC page (old version is probably more forgiving).

I'm trying the plugin now. I did notice the LED stays on for longer, I suppose it's waiting for any more data.

Update:  Is working, I found a couple of keys had an unexpected behavior, but is probably a scripting issue, I'll let you know.   :)
Title: Re: WinLIRC driver update
Post by: dukey on July 31, 2010, 01:59:03 am
Glad you got it working. Spent ages debugging a damn threading error with that plugin :) You could always make a new config if you have any problems. Best thing to do is, if you know what protocol your remote uses, use one of the templates

-> http://lirc.sourceforge.net/remotes/generic/ (http://lirc.sourceforge.net/remotes/generic/)

Then just learn the buttons. Or you can use your existing config, and just re-learn the buttons ure having problems with. The documentation for IRRecord is a bit thin admittedly, but its basically the same as the linux version, so just google some info for that.
Title: Re: WinLIRC driver update
Post by: liyin on July 31, 2010, 03:18:39 am
Thanks for the plugin dukey, now I have a USB option I can use with my current configuration (no changes required), instead of the old serial port LIRC IR receiver.

The audio plugin seems like a good option, too.
Title: Re: WinLIRC driver update
Post by: ian on August 01, 2010, 02:13:17 pm
This is really awesome, thanks so much, great job. I think my previous post didn't work, I thought I posted earlier. I'll post this up on the blog for more testers too.

Did the IR Toy arrive from Seeed already?

Thanks again, WinLIRC support is awesome. I'm going to write a tutorial and add WinLIRC stuff to the documentation and links pages. I'll send you a hand-built v1.1 prototype when I get the boards in (should be this week).

The graphing tool is great too, I can't wait to try it.
Title: Re: WinLIRC driver update
Post by: dukey on August 01, 2010, 02:41:26 pm
Yeah my IR Toy arrived a day or two ago :) I wouldn't have been able to finish the plugin without it. The only thing really to note is, the plugin leaves the receiver in timing mode, but this shouldn't be too much of an issue. It's a real good thing also you added the timing mode, made life a lot easier for me :)

If you wanted to add a cool addition to something like this, it would be the ability to power up the PC when it receives a certain infra-red code.  I believe there is a product out there that does this, but I forget what it's called.

I've messed about with the IRMan mode a little, but it seems very limited. Does it just work with RC5 remotes ? I got 4 remotes on my desk here and it works with just 1 of them. Also, isn't it supposed to send back a 6 byte code ? In the hercules console thing it seems to send back just 1 byte, which is sufficient for RC5 I guess.
Title: Re: WinLIRC driver update
Post by: ian on August 01, 2010, 07:57:04 pm
Yup, it's RC5 only, though there is some code somewhere to do a few others that should be integrated.

That's a great feature, I'll work on it - at least wake on IR to start.

I think herculese doesn't display unprintable characters in ASCII mode, just switch to HEX to see the trailing 0x00.
Title: Re: WinLIRC driver update
Post by: liyin on August 01, 2010, 07:59:25 pm
Would it be possible for the plugin or WinLIRC to send "x00" five times on exit to put the IR Toy in RC5/IRMan mode?   (See image below)

One issue I have/had is that with the old LIRC circuit & WinLIRC 0.6.5 my PC wouldn't stay in Standby mode if I turned on the fluorescent lights. Now with the IR Toy it has happened a couple of times, but will test to find out the reason.

RC5/IRMan mode is the easiest to use, it gives you a consistent set of bytes for each button pressed on the remote control, and in the end that's all you want to know, what button was pressed. The IR Toy is doing the hard work for you, and any universal remote has a Phillips TV/VCR mode. So the problem arises for people using a particular remote that doesn't have codes for other manufacturers (Phillips - RC5). For those using an universal remote control both IR Toy modes will work.
Title: Re: WinLIRC driver update
Post by: rsdio on August 01, 2010, 09:25:08 pm
[quote author="dukey"]If you wanted to add a cool addition to something like this, it would be the ability to power up the PC when it receives a certain infra-red code.  I believe there is a product out there that does this, but I forget what it's called.[/quote]Do you mean power up the PC or just wake it?  I don't think the USB IR Toy could turn on a PC that has no power, because the USB would not have any power and the USB IR Toy itself would be off.  But it would seem possible to wake the host using a USB resume command.
Title: Re: WinLIRC driver update
Post by: dukey on August 03, 2010, 12:24:21 am
I think the product I saw actually had some sort of relay, that directly powered on the pc, or crossed the connection which turns it on. But there are other ways to do this I think, wake on Lan, maybe some USB thing. I built myself a media centre pc for my living room, being able to turn it on with my remote is about the only thing I am missing.
Title: Re: WinLIRC driver update
Post by: liyin on August 03, 2010, 05:29:35 am
Yep, my PC wakes up from Standby mode when I turn on the lights.
Title: Re: WinLIRC driver update
Post by: rsdio on August 03, 2010, 07:51:27 am
[quote author="liyin"]
Yep, my PC wakes up from Standby mode when I turn on the lights.
[/quote]Ok, if all you need is wake from Standby, then the USB IR Toy should be able to do this with some firmware coding.  The Descriptors must announce to the host PC that the IR Toy is capable of initiating a "resume" (wake up), because most USB devices cannot do this and thus are not expected to be able to do it.  Once advertised, the USB IR Toy would implement this by dropping current below 100 mA, I think (and I believe the IR Toy is probably already under that limit), and then it would send a resume command to the host when the right IR command is received.  I believe that the Microchip sample code even has this feature, although I've never used it.
Title: Re: WinLIRC driver update
Post by: ian on August 03, 2010, 08:34:58 am
Quote
and then it would send a resume command to the host when the right IR command is received.  I believe that the Microchip sample code even has this feature, although I've never used it.

That was my thought too.
Title: Re: WinLIRC driver update
Post by: Shadowsoul on August 16, 2010, 09:19:51 pm
[quote author="dukey"]
I think the product I saw actually had some sort of relay, that directly powered on the pc, or crossed the connection which turns it on. But there are other ways to do this I think, wake on Lan, maybe some USB thing. I built myself a media centre pc for my living room, being able to turn it on with my remote is about the only thing I am missing.
[/quote]

I think a simple 2-pin (or 3, can't remember if WOL actually uses all 3 pins or not) connector that is connect to the PIC might be the best option for this.
That way we can just hook up any connector we want for the different power-on features, a relay to use for shorting the power on-pins on MB or WOL/WOUSB/whatever have you..

A relay connected to the power-pins on the MB is by far the most reliable as it works even when the computer is just in stand by mode, and not all motherboards support wake on USB =(
Would need some kind of learning mode though to store the actualy power-code..
Title: Re: WinLIRC driver update
Post by: rsdio on August 17, 2010, 12:57:34 am
[quote author="Shadowsoul"]A relay connected to the power-pins on the MB is by far the most reliable as it works even when the computer is just in stand by mode, and not all motherboards support wake on USB =([/quote]I don't understand. How can a relay turn on a computer that is already on and in standby mode?  What you describe could turn off the computer, but would not be able to turn it on.  Also, don't forget that the USB IR Toy is powered by the computer, so it cannot turn on a relay for a computer that is turned off, unless you have two computers (one that is always on to power the USB IR Toy, and the other computer which can be turned on by remote).

Maybe someone should describe exactly what the goal is here, since I thought it was to wake a computer that is already powered on.
Title: Re: WinLIRC driver update
Post by: Shadowsoul on August 17, 2010, 08:07:58 pm
[quote author="rsdio"]
I don't understand. How can a relay turn on a computer that is already on and in standby mode?  What you describe could turn off the computer, but would not be able to turn it on.  Also, don't forget that the USB IR Toy is powered by the computer, so it cannot turn on a relay for a computer that is turned off, unless you have two computers (one that is always on to power the USB IR Toy, and the other computer which can be turned on by remote).

Maybe someone should describe exactly what the goal is here, since I thought it was to wake a computer that is already powered on.
[/quote]


It depends on the motherboard of course, but the OS's I've used wake the computer from sleep when you hit the power button (I use the term Stand By as "powered off", different from "Sleep" which means the computer still maintains power to e.g. RAM and the input ports. Hibernation is pretty much equivalent to stand by except it persists all memory on disk before shutting down).
Also alot of motherboards keep the USB ports powered on even when in stand by mode which means the USB IR Toy will be powered, if the motherboard doesn't those of us in need of said functionality can easily steal some power from the +3.3V rail on the ATX connector, it is always powered as per the specification to be able to "power on" the computer.


If the goal is simply to be able to wake a computer in sleep mode my guess is nothing should be needed at all. Most OS's should support resume on USB activity.
Alot of motherboards also support Wake-On-USB if enabled in the BIOS which means the computer starts from stand by on USB activity (which to be honest frigging sucks if you touch the mouse or keyboard for example).

The reason I suggested a connector is to be able to choose a fitting way for the motherboard in question. That is if the goal is to have some form of "external" start function of course. As a side note, stand by (powered off) means drawing something like 1W-10W of power depending on the PSU, most computers in sleep mode that I've seen draw somewhere along the lines of 50W, which is why I'd prefer a true "power on"-solution.
Title: Re: WinLIRC driver update
Post by: rsdio on August 17, 2010, 10:50:48 pm
[quote author="Shadowsoul"]
(I use the term Stand By as "powered off", different from "Sleep" which means the computer still maintains power to e.g. RAM and the input ports. Hibernation is pretty much equivalent to stand by except it persists all memory on disk before shutting down).[/quote]
Quote
If the goal is simply to be able to wake a computer in sleep mode my guess is nothing should be needed at all. Most OS's should support resume on USB activity.
Alot of motherboards also support Wake-On-USB if enabled in the BIOS which means the computer starts from stand by on USB activity (which to be honest frigging sucks if you touch the mouse or keyboard for example).
Ah, it makes sense when you describe everything at once.

I don't use the PC, so Hibernation is just something I've thought about but never used (in fact, I described hibernation to Microsoft in an interview way back in 1991/1992 before I quit).  Seems like you just need to momentarily close the "power" button to "wake" the PC from Hibernation, so a connector and relay would be a good choice, as you suggested.

As for Wake-on-USB, I agree that it can suck, but I think that the official USB specification is supposed to allow some control over this (more than BIOS).  A given USB device has the option of describing itself as capable of initiating resume, or not.  That's not programmable by the user, though, but a device designer should be able to turn it off.  A proper USB host should not wake on USB data from a device that is not officially supposed to be doing that.  Don't know if this actually helps anything, though, since you can't really rewrite the descriptors on your mouse.
Title: Re: WinLIRC driver update
Post by: Shadowsoul on August 17, 2010, 11:59:17 pm
[quote author="rsdio"]
Ah, it makes sense when you describe everything at once.

I don't use the PC, so Hibernation is just something I've thought about but never used (in fact, I described hibernation to Microsoft in an interview way back in 1991/1992 before I quit).  Seems like you just need to momentarily close the "power" button to "wake" the PC from Hibernation, so a connector and relay would be a good choice, as you suggested.

As for Wake-on-USB, I agree that it can suck, but I think that the official USB specification is supposed to allow some control over this (more than BIOS).  A given USB device has the option of describing itself as capable of initiating resume, or not.  That's not programmable by the user, though, but a device designer should be able to turn it off.  A proper USB host should not wake on USB data from a device that is not officially supposed to be doing that.  Don't know if this actually helps anything, though, since you can't really rewrite the descriptors on your mouse.
[/quote]


I took a quick look at how Microsoft has implemented the Wake-On-USB functionality. To be able to use it a real USB device driver is needed. You must manually enable Wake-On-USB for each device that you want to be able to wake the computer...sadly COMM-ports lacks that alternative, so it's a no-go to use the virtual COMM for it.
No idea how it's handled on MAC. I assume it's not handled out of the box on Linux or BSD, but as always it can be hacked into the kernel if need be :P

Also I need to amend my claims a bit, I think I must have had something that prevented true S3 sleep mode on the computers I tried it on. Apparently for most people S3 drops power usage to below 20W.
 Haven't used either S3 or hibernation in years myself though, always something that stops working after resuming.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01332146544session_write_close ( )...(null):0
20.01362278136ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01362278912Database_MySQL->query( ).../DatabaseHandler.php:119
40.05842417640Database_MySQL->error( ).../Db-mysql.class.php:273