LinHES Forums http://forum.linhes.org/ |
|
Using the Twinhan/Visionplus remote http://forum.linhes.org/viewtopic.php?f=11&t=10329 |
Page 1 of 2 |
Author: | manicmike [ Fri Jun 02, 2006 7:18 pm ] |
Post subject: | Using the Twinhan/Visionplus remote |
Hi folks, I've found this card very reliable after a few tweaks (and it's incredibly cheap). The remote is a USB thing and is essentially a keyboard. Re-mapping the keys is a slow process, which I've done, for most of them. This means you can put your keyboard away for TV viewing. It's pretty basic functionality. http://www.better-access.com/keybindings.sql To import it, type (logged in as mythtv) ``cat keybindings.sql|mysql -p mythconverg'' and put your mythtv password in when prompted. It will blow away your existing keybindings, so you may want to make a backup first (mysqldump -p mythconverg keybindings > oldkeys.sql). Mike ps any tweaks and I'd be glad to modify the sql.[/url] |
Author: | nigelpearson [ Tue Jun 06, 2006 7:29 pm ] |
Post subject: | |
Thanks for your work on this, Mike. Note to anyone who is going to import this that it will only work if you have a single frontend called saturn ![]() Some judicious editing of that file may be in order. Or maybe just use MythWeb to set the keybindings manually, using the data that is in the file? |
Author: | kearnesw [ Tue Jun 13, 2006 5:29 pm ] |
Post subject: | Re: Using the Twinhan/Visionplus remote |
Hi, I was going to remap all my keys in this way as well, but I believe I have an even better way of getting the remote working 100%, inlucding the POWER button to run a mythpower script to stop/start mythfrontend (extremely high WAF). The key is that it is a USBHID keyboard (uses usbhid.ko kernel module), and my real keyboard uses the PS2 connection. Therefore I can do anything I like to the usbhid module without affecting any other input devices, this includes remapping the actual keymap for the usbhid keyboard. I'm not sure what happens if you use a USB keyboard as your normal keyboard - I would guess that the keys would end up remapped for the standard keyboard as well, but I'm not sure. Because the keys are actually remapped (e.g. the left button (Vol+ I think) now does a Left Arrow keystroke, and the up button (CH+) now does an Up Arrow keystroke (instead of Ctrl-Pageup or whatever it was)), it also means that the remote works well for many other applications (such as mplayer for video playback). I found a C program that remapped the keyboard (do a search for usbhid-twinhan.c), which I had to do some tweaking with to get it working to remap the keys for my module. The result is that the remote can be used to control mythtv without remapping any keys in myth, and the power button can be setup to run a script rather than switching to Console6 (Ctrl-Alt-Shift-F6, as it does by default for some reason - so I have it remapped to Alt-F6 which can be mapped to any function). I am at work at the moment, so I don't have access to the C program, but I will post it tonight as soon as I get home. I have been using myth for a year or 2 now, and it will be great to contribute something to the community for a change, so I hope this will be useful to some of you. Cheers, Wayne manicmike wrote: Hi folks,
I've found this card very reliable after a few tweaks (and it's incredibly cheap). The remote is a USB thing and is essentially a keyboard. Re-mapping the keys is a slow process, which I've done, for most of them. This means you can put your keyboard away for TV viewing. It's pretty basic functionality. http://www.better-access.com/keybindings.sql To import it, type (logged in as mythtv) ``cat keybindings.sql|mysql -p mythconverg'' and put your mythtv password in when prompted. It will blow away your existing keybindings, so you may want to make a backup first (mysqldump -p mythconverg keybindings > oldkeys.sql). Mike ps any tweaks and I'd be glad to modify the sql.[/url] |
Author: | Girkers [ Tue Jun 13, 2006 10:38 pm ] |
Post subject: | |
kearnesw, I would be greatly appreciative if you could come up with a solution that works as I have two of these remotes and would love to use them. It would go a BIG jump forward in the WAF steaks. Looking forward to it. |
Author: | kearnesw [ Wed Jun 14, 2006 2:11 am ] |
Post subject: | Re: Using the Twinhan/Visionplus remote |
Good to hear someone is interested. I just got home, so as promised here is the C progam and some basic instruntions on how to use it. I'm not sure how to do an attachment, so I have put the text in a quote box at the end of this post. I have only a very vague idea of how the keymaps were originally determined, so don't hassle me about that. Anyway here is the process:
NOTE: Knoppmyth R5C7 delivers usbhid as a module, so no kernel rebuild is necessary.
That gets the remote working quite nicely with the default MythTV key bindings. If there are any keys you aren't happy with you can remap their binding in mythfrontend nowdays. Now if you want the Power button, which is the main reason I went with this method of getting the remote to work (as I couldn't seem to remap the Ctrl-Alt-Shift-F6 as it seems to be hard-wired in Linux to switch consoles). Anyway with the default FluxBox GUI used in Knoppmyth I did the follwoing to remap the new Alt-F6 keystroke for the power button:
Quote: #!/bin/bash PROG=mythfrontend STATUS=`ps -e | grep $PROG | grep -v grep | wc -l | awk '{print $1}'` if [ `echo $DISPLAY | grep -c ":0"` -ge 1 ] then if [ $STATUS -eq 0 ] then ( $PROG & ) else killall $PROG fi fi exit 0 USBHID-TWINHAN.C Code: Quote: // TwinHan VisionPlus DVB-T card remote
// Changes the keymaping for usb keyboards so the remote better matches MythTV // gcc usbhid-twinhan.c -o usbhid-twinhan // no options for install // some options for uninstall // Copyright 2005/07/13 Paul Andreassen /* Button keyboard key showkey new key code MythWeb fullscreen z 2c SKIPCOMMERCIAL power Ctrl-Alt-Shift-F6 1d-38-2a-40 Alt-F6 changes to console 6 1-9-0 1-9-0 02-0a-0b 1-9-0 record Home 66 r 13 TOGGLERECORD favourite v 2f / 35 NEXTFAV NEXTFAV rewind i 17 home 66 PREVVIEW PREVTRACK CLEARMAP DAYLEFT SKIPCOMMBACK forward n 31 end 6b NEXTVIEW NEXTTRACK LOADCOMMSKIP DAYRIGHT SKIPCOMMERICAL CH+ pageup 68 up 67 UP CHANNELUP CH- pagedown 6d down 6c DOWN CHANNELDOWN play return 1c SELECT vol+ SHIFT-up 2a-67 right 2a-6a RIGHT RANKINC SEEKFFWD vol- SHIFT-down 2a-6c left 2a-69 LEFT RACKDEC SEEKRWND recall c 2e i 17 INFO RETRIEVENEWS INVERTMAP stop End 6b d 20 DELETE DELETE DELETE DELETE timeshift/pause t 14 p 19 PAUSE PLAYBACK PAUSE PAUSE mute m 32 F9 43 MUTE MUTE cancel Escape 01 ESCAPE capture p 19 w 11 TOGGLEASPECT preview k 25 a 1e TOGGLESTRETCH EPG e 12 s 1f GUIDE record list l 26 m 32 MENU tab Tab(beeps) 0f pageup 68 PAGEUP RWND PREVCUT JUMPRWND teletext a 1e pagedown 6d PAGEDOWN FFWD NEXTCUT JUMPFFWD */ #include <stdio.h> //#define unk KEY_UNKNOWN #define unk 240 static unsigned char hid_keyboard_orig[256] = { 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 14, 15, 57, 12, 13, 26, 27, 43, 43, 39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 87, 88, 99, 70,119,110,102,104,111,107,109,106, 105,108,103, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71, 72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190, 191,192,193,194,134,138,130,132,128,129,131,137,133,135,136,113, 115,114,unk,unk,unk,121,unk, 89, 93,124, 92, 94, 95,unk,unk,unk, 122,123, 90, 91, 85,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113, 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk }; static unsigned char hid_keyboard_new[256] = { 0, 0, 0, 0,109, 48, 23, 32, 31, 33, 34, 35,102, 36, 30, 50, 67,107, 24, 17, 16, 19, 31, 25, 22, 53, 17, 45, 21, 44, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 14,104, 57, 12, 13, 26, 27, 43, 43, 39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 87, 88, 99, 70,119,110, 19,103,111, 32,108,106, 105,105,106, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71, 72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190, 191,192,193,194,134,138,130,132,128,unk,131,137,133,135,136,113, 115,114,unk,unk,unk,121,unk, 89, 93,124, 92, 94, 95,unk,unk,unk, 122,123, 90, 91, 85,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, unk, 0, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113, 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk }; //static unsigned char hid_keyboard_new[256] = { // 0, 0, 0, 0,109, 48, 23, 32, 31, 33, 34, 35,102, 36, 30, 50, // 67,107, 24, 17, 16, 19, 31, 25, 22, 53, 17, 45, 21, 44, 2, 3, // 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 14,104, 57, 12, 13, 26, // 27, 43, 43, 39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, **WAK**19, // 65, 66, 67, 68, 87, 88, 99, 70,119,110, 19,103,111, 32,108,106, // 105,105,106, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71, // 72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190, // 191,192,193,194,134,138,130,132,128, **WAK**129,131,137,133,135,136,113, // 115,114,unk,unk,unk,121,unk, 89, 93,124, 92, 94, 95,unk,unk,unk, // 122,123, 90, 91, 85,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, // unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, // unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, // unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, // unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk,unk, // **WAK**29, 0, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113, // 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk //}; #define SIZE 256 // *** Change the following line to reference the correct kernel module ($KVER) char filenamestr[]="/lib/modules/2.6.15-chw-2/kernel/drivers/usb/input/usbhid.ko"; int main(int argc, char *argv[]) { unsigned char *bsearch, *breplace; FILE *fo; char unamer[SIZE]; char filename[SIZE]; int pos=0; unsigned char byte; if (argc == 1) { printf("Installing\n"); bsearch = hid_keyboard_orig; breplace = hid_keyboard_new; } else { printf("UN-installing\n"); bsearch = hid_keyboard_new; breplace = hid_keyboard_orig; } if ((fo=popen("uname -r","r"))==NULL) { printf("Can't popen uname -r\n"); exit(1); } pos=fread(unamer,1,SIZE,fo); if ((pclose(fo)==-1)||(pos==0)||(pos==SIZE)) { printf("Error with uname -r\n"); exit(1); } unamer[pos-1]=0; // remove trailing \n pos=snprintf(filename,SIZE,filenamestr,unamer); if ((pos<0)||(pos>=SIZE)) { printf("Error with snprintf (%s)\n",filename); exit(1); } if ((fo=fopen(filename,"r+b"))==NULL) { printf("Can't open %s\n",filename); exit(1); } printf("Searching %s\n",filename); pos=0; while (fread(&byte, 1, 1, fo) == 1) { if (byte==bsearch[pos]) { pos++; if (pos==256) { printf("Found\n"); int back=-pos; fseek(fo, back, SEEK_CUR); if (fwrite(breplace, 1, pos, fo)==pos) { printf("Wrote ok\n"); } else { printf("Error wrote short\n"); } pos=0; break; } } else { if (pos>4) { printf("pos=%d byte=%d bsearch[%d]=%d\n",pos,byte,pos,bsearch[pos]); } // jump back to the starting byte of this match int back=-pos; fseek(fo, back+1, SEEK_CUR); pos = 0; } /* printf("%d, ",byte); pos++; if (pos==256) { printf("\n"); pos = 0; } */ } fclose(fo); return 0; } My next step is to get ACPI working or this box. I had wakeup/shutdown working perfectly in my FC4 setup, so hopefully I can get it going again for KnoppMyth. Then I will tackle getting my Winfast DTV1000 Remote working with lirc. Out of interest has anyone been able to get this type of remote working? It is one of thos 3.5mm jack types that plug into the Card. Hope This Helps. |
Author: | kearnesw [ Wed Jun 14, 2006 2:13 am ] |
Post subject: | Re: Using the Twinhan/Visionplus remote |
Sorry but the post seems to have lost all the indentation in the code, so it looks a bit ugly, but it will still work AOK. |
Author: | Girkers [ Thu Jun 15, 2006 4:42 pm ] |
Post subject: | |
I am runnig R5C7 so I will try and give this a go on the weekend. Thanks |
Author: | manicmike [ Mon Jun 19, 2006 10:09 pm ] |
Post subject: | |
Girkers wrote: I am runnig R5C7 so I will try and give this a go on the weekend.
Thanks Wow! Fantastic that so many people have added to this. I've updated a few things in the key list and documented it. The new SQL is at http://www.better-access.com/keys.sql. Replace the hostname with your own (I set it to 'mythtv'). A quick way to do this is to use sed. sed 's/mythtv/YOUR-HOSTNAME/' keys.sql > newkeys.sql then import with "cat newkeys.sql | mysql -u mythtv -p mythconverg" The instructions are in OpenOffice format at http://www.better-access.com/Mythtv-docco.odt or as pdf at http://www.better-access.com/Mythtv-docco.pdf. Media Player I've found that xine is a fantastic media player (the Internal one doesn't do .avi playback consistently well and mplayer doesn't show DVD menus), so I put the keys at http://www.better-access.com/xinekeys. To use it, copy it to /home/mythtv/.xine/keymap and change the dvd player to "xine -V xv -f dvd://", and the video player to "xine -f -g -V xv". |
Author: | hoki_goujons [ Tue Jun 20, 2006 1:43 am ] |
Post subject: | |
Just to reply to kearnesw's code - I tried this with my Twinhan 3020 and it works like a charm; thanks very much for sharing that. Now that the receiver is working well, does anyone know if I could use the remote from my Hauppauge MVP with theTwinhan receiver? The Hauppauge one is a bit less cheap-looking and has got the handy 'Jump' buttons for music, videos etc. I've tried pointing it at the receiver and pressing buttons, but no characters are being output when I do so. |
Author: | neutron68 [ Sat Jun 24, 2006 1:24 pm ] |
Post subject: | how to activate a Twinhan IR remote |
My friend has a Twinhan IR remote and USB IR receiver. Originally, when we installed his KnoppMyth R5C7, I just chose an RCA remote because he had one laying around and also there was no TwinHan remote listed in the /usr/local/bin/lirc-reconfig.sh file. I saw there was an LIRC config file for the Tiwnhan remote at http://lirc.sourceforge.net/remotes/twinhan/ So, I just copied that file to my friend's /etc/lircd.conf file. After reboot, my friend reports remote functionality. He says the numbers work correctly and the power button takes him to a full-screen linux shell. As far as button mapping, I suspect that the RCA remote button mapping is still in effect. Is there a button definition file I need to replace or edit? There was no button definition file inside the http://lirc.sourceforge.net/remotes/twinhan/ directory. Eric |
Author: | Girkers [ Sun Jun 25, 2006 5:34 am ] |
Post subject: | |
neutron68, My numbers and play (enter) key work without any modification and if you read the earlier post the power button does an ALT+F6 which takes you to a linux shell. To get the remote working properly you can not use lirc as the remote receiver is detected as a keyboard and will not work with lirc, I have tried and tried. Read the earlier posts in this thread and try one of the other two methods. |
Author: | neutron68 [ Sun Jun 25, 2006 12:12 pm ] |
Post subject: | understood - Twinhan not lirc compatible |
Thanks for your information on the Twinhan system! Girkers wrote: To get the remote working properly you cannot use lirc as the remote receiver is detected as a keyboard and will not work with lirc, I have tried and tried. Read the earlier posts in this thread and try one of the other two methods.
Since the Twinhan IR receiver is not lirc compatible, could the Twinhan remote control still be used if the IR receiver was a simple RS-232 receiver? I was also looking for the correct procedure for installing a new IR remote. (So, I can switch to an RCA or Pansat remote if that would have better functionality.) Am I correct that all I need to do is copy the appropriate remote control config file into the file /etc/lircd.conf and then reboot? Thanks! Eric |
Author: | Girkers [ Wed Jun 28, 2006 8:49 pm ] |
Post subject: | |
Firstly I would like to thank manicmike as I have implemented both of his remote wonders and they are great, both the MythTV and Xine stuff. The WAF has increased remarkably, so much so my wife now talks to me ![]() My next question is though what are the differences between manicmike's and kearnesw's implementations. If anyone is interested I may write a script to implement the remote keys using manicmike's implementation, drop me a post in here or via email. |
Author: | Ramrunner [ Fri Jul 07, 2006 6:35 pm ] |
Post subject: | Not working? |
Hey guys, I followed the instructions as written here, and I get: Searching /lib/modules/2.6.15-chw-2/kernel/drivers/usb/input/usbhid.ko But nothing else. after modprobing as instructed, my navigation keys do not work. Only cancel and enter seem to do something in the menus. Looking at the source, I most definitely need to see more output from the program, and I don't think it's patched the module as it should. Funny thing is, when I locate usbhid.ko, it finds it exactly where it is looking for it. It must be dropping out somewhere in the while loop but I'm most certainly not a programmer. Any ideas what could couse it to not do the bsearch/fwrite parts? I don't know what they mean or do, but I'm assuming thats's the part that does the magic. Regards, Ed. |
Author: | Ramrunner [ Fri Jul 07, 2006 6:51 pm ] |
Post subject: | Scratch that |
OK, scratch the above, I somehow must have managed to have another version of the usbhid-twinhan file from somewhere else, when I copy and paste the code below, I do get: Installing Searching /lib/modules/2.6.15-chw-2/kernel/drivers/usb/input/usbhid.ko Found Wrote ok Then I do the modprobes. Then I still get the keys no good. My rewind button seems to move up in the menus, but up down left right (the most important) do nothing in the menu. On the back of my remote, I have HH-338 Do I even have the same remote as you guys? Regards, Ed. |
Page 1 of 2 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |