New plugin: xboxlibusb (Xbox DVD Movie Playback Kit Dongle)
Jannik Vogel <[email protected]> Thu, 27 Sep 2018 23:59:36 +0200
| Newsgroups | gmane.comp.hardware.lirc |
|---|---|
| Message-ID | <CA+kn46zEfKTUqBOPSxZXFKwMaaiChYVsWgrwFhwduu7OTv=3EA@mail.gmail.com> |
Hey everyone, I've developed a new libusb plugin for the Dongle of the Xbox DVD Movie Playback Kit. I've already put some of my observations at http://xboxdevwiki.net/Xbox_DVD_Movie_Playback_Kit (which also describes the hardware and involved IR / USB protocols). While this receiver is more than 15 years old and isn't sold in stores anymore, it can be bought very cheaply on places like ebay (mine included remote and dongle, for less than $5). As a result people still resort to the old lirc_xbox kernel module for LIRC 0.9, or other weird hacks (such as using an ancient lirc_atiusb, which is a giant hack). The motivation for this plugin is that the Xbox remote works out-of-the-box with the original Dongle which can be connected via a cheap USB adapter cable (available from China). At the time of writing, my code can be found here (might move in the future): https://github.com/JayFoxRox/lirc-xboxlibusb/tree/xboxlibusb --- Some design decisions: - uses pthread instead of `fork()` because I had issues where `SIGTERM` during `usb_interrupt_read` (as in atilibusb) would break traffic after connecting `irw` a second time - uses libusb-1.0 so we can also work around that issue by manually cancelling a transfer - recreates the IR payload, which includes the negated data; so this works with known serial remote configurations[1] (possibly also supports the 360 MCE remotes[2]); I could not confirm the actual IR signal and had to extrapolate it from LIRC configurations, so this is a bit of a hack - adds support for 3 known DVD dongles (Gamester / Microsoft / Unknown) - plugin name matches what you'd expect from older LIRC drivers, although the Xbox term might also refer to Xbox 360 or Xbox One these days - the first USB packet is ignored, because it might have been in the buffer for a very long time - the USB protocol also tells us how many milliseconds since the last press, but this information is ignored - the USB protocol also tells us what appears to be a packet length, but this information is ignored Some remaining questions: - do I have to add any special Makefile magic to handle pthread and libusb-1.0 correctly (on other platforms)? - shall I remove or mark the DVD dongles I did not test? (I only own 045E:0284, but assume others to work fine, or with minor changes) - shall I make the IR payload recreation hack optional? (only would return 8 or 12 data bits, 4 bits are presumably constant start marker) - what version should I give my plugin? - what's the best way to have this plugin integrated into upcoming LIRC releases? I already did run it through valgrind; so there are no known leaks / invalid accesses. But probably not catching all edge-cases yet. There's also a lot of atilibusb stupidity left in the code (which this was originally based off, until almost a full refactor). The worst issue is probably that removing the USB device while it's in use, breaks horribly so you have to restart `lircd` (which is fine for my use-case, but I'd be willing to fix it, if it was a requirement to get this plugin upstreamed - although I'm aware of similar crimes in other plugins). I've also only tested on Arch Linux using `irw`; more test results for other platforms would be nice. I might not see all responses because I passionately hate sourceforge and mailing lists (and therefore don't want to subscribe). You can also leave feedback on my github repository (although I want to upstream this plugin, and will read the ml-archive from time to time). Greetings, Jannik [1] https://sourceforge.net/p/lirc-remotes/code/ci/master/tree/remotes/microsoft/Xbox.lircd.conf [2] https://sourceforge.net/p/lirc-remotes/code/ci/master/tree/remotes/microsoft/Xbox_MCE.lircd.conf