Weblog entry #25 for dkg

USB Infrared recommendations for debian?
Posted by dkg on Wed 12 Dec 2007 at 05:08
Tags: , ,
I just noticed that one of the bodegas in my neighborhood sells "universal remotes" for a few USD. These are designed to work with arbitrary televisions, and can be switched/programmed to emit various IR signals. I've got an NSLU2 running sid, which feeds audio to my stereo using mpd. I'd like to use one of the cheap-o remotes to at least start/stop the audio and adjust the volume.

I suspect that the way to do that is with LIRC (as Utumno mentioned), but i'm not sure what kind of USB infrared devices will be compatible. The NSLU2 only has USB ports -- no RS-232 or anything else. Anyone with more experience in this area care to suggest a USB IR receiver that works well with a TV remote?

 

Comments on this Entry

Posted by OvejaNegra (81.202.xx.xx) on Wed 12 Dec 2007 at 21:24
[ Send Message ]
Hello

well my advice is easier than that
I bought one of those crappy cordless presentations pointers to do presentations in powerpoint. The cheaper the better. It turns out that every time you press the forward key (which would take you to the next slide in powerpoint) my linux detected that the "F" key was pressed, and so on. So basicly the mouse was like a keyboard with 4 keys only (B, F, Home, End)

Then what I do is, with Xmodmap i assigned every one of those keys to an event and then in KDE I assign actions to those events

Since your NSLU2 doesn't have KDE it's even easier

The only thing you would need to do is to execute a script like:

bind B 'mpd --lastsong'
bind F 'mpd --nextsong'
bind Home 'mpd --volumedown 5%'
bind End 'mpd --volumeup 5%'

Or whatever the sintaxis is

The only problem I see is that I don't know if you need to be logged in a tty for the bind command to work, that may be troublesome

Well if you have a USB keyboard you can try for free whether my idea works or not and then buy a "USB cordless presentation mouse" if it does and you will have a nice remote control for your NSLU ;)

Just my 2 cents :/

[ Parent | Reply to this comment ]

Posted by dkg (216.254.xx.xx) on Wed 12 Dec 2007 at 22:14
[ Send Message | View dkg's Scratchpad | View Weblogs ]
that's a neat idea, thanks. The cheapest ones of those i've been able to find are still $25-$30, though. (or $40 with a dubious $20 rebate). Any links to the real bottom of the barrel?

It now occurs to me that i could also just use a USB mouse. it wouldn't be wireless, but if i had 3 buttons and a wheel to work with, maybe i can just get away with that.

[ Parent | Reply to this comment ]

Posted by OvejaNegra (81.202.xx.xx) on Wed 12 Dec 2007 at 22:58
[ Send Message ]
i am telling you that my idea works great in KDE. But u have a big problem with the NSLU.

I would not buy anything until you know it's going to work, so I would make the test with an usb keyboard or a usb mouse that u already have

As i was saying u have a big problem in the NSLU. If u press a key in your keyboard, you need a console opened so you can see the result of the pressed key. But what about NSLU, u don't have any opened ttys so even though you press the F key ...where is that keystroke going?? I don't know if u understand what i mean.
Maybe i am very wrong but even though u press one key what process is getting the standard input of that?
We should figure out a way to do this

[ Parent | Reply to this comment ]

Posted by dkg (216.254.xx.xx) on Wed 12 Dec 2007 at 23:27
[ Send Message | View dkg's Scratchpad | View Weblogs ]
Oh, sorry: i totally understood what you meant about the kbd/mouse when there's no graphical console. I figure i'll write a little glue to link up /dev/input/mice (or some similar keyboard device file) to whatever mpd client i need to run to get it to work. I'm not too worried about that part, though i do appreciate that it's an unusual way to use /dev/input/mice. I'll post what ever i work out here when i get it working.

But i'm still looking for what my hardware options are. Do you have a link handy for a really cheap wireless presenter remote like you mentioned in your first comment?

[ Parent | Reply to this comment ]

Posted by OvejaNegra (81.202.xx.xx) on Thu 13 Dec 2007 at 00:02
[ Send Message ]
I have exactly this

http://www.softworld.es/labtec_presenter/

It was 20 in a shop around the corner, but i admit it was on sales. I think the trick is that you dn't need drivers to make it work on MS powerpoint (the cheaper the better, see?), so in the end every key behaves like the keryboard key you would press to do the job (and so u don't need drivers). It turned out that they behave like LEFT, RIGHT, ESCAPE, and RETURN, so in the end it is juast a keyboard with only these 4 keys as I said.

But if u are going to test it you can do it with a normal mouse I'm sure it would work too, i would not like to see you buying something that you can not use later

Good luck, man!

[ Parent | Reply to this comment ]

Posted by dkg (216.254.xx.xx) on Thu 13 Dec 2007 at 07:15
[ Send Message | View dkg's Scratchpad | View Weblogs ]
I hooked up an old USB wheel mouse i had lying around to the NSLU2, and read up a bit on the Linux event interface.

So i wrote a little program called mousempc to hook the mouse into mpd. Seems to work fine for me for simple controls: volume up/down, play/pause, next/prev. You'll need libmpd-dev if you want to build it.

With a bit more coding sophistication/keeping track of what buttons are pressed (double-clicks, pressing two buttons simultaneously, click-n-drag, etc), i could probably make the mouse do a lot more (seek/scan, playlist re-organization, etc). I'm not even using the actual mouse pointer info at all yet.

Since this old mouse has a 10 ft. cord, i'm not even sure i want an IR device any more. Thanks for sending me down this path!

The one thing i'm not sure how to handle cleanly is identifying the specific device node for the mouse in the first place (i did it this time with a recursive diff comparison of the /dev/ tree before and after device insertion, but that's a little clumsy).

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search