After downloading the MythTV package from MythTV.org's Downloads page and compiling mythlcdserver
, I discovered that KnoppMyth used a slightly newer version of the files (and resulting libraries). Wasted a lot of time there, but got the last stable release out of subversion (which, fortunately, was the same version used by KnoppMyth), and I am now able to compile MythTV modules with the correct library. Mostly. I am getting this error with mythtranscode/replex
:
/usr/lib/libmythavcodec-0.20.1.so: undefined reference to `XvMCLoadQMatrix'
/usr/lib/libmythavcodec-0.20.1.so: undefined reference to `XvMCSyncSurface'
/usr/lib/libmythavcodec-0.20.1.so: undefined reference to `XvMCFlushSurface'
/usr/lib/libmythavcodec-0.20.1.so: undefined reference to `XvMCBeginSurface'
collect2: ld returned 1 exit status
make: *** [mythreplex] Error 1
But I intend to ignore it for now as it happens after mythlcdserver
is compiled. (This is going to bug people searching for an answer to this problem and finding none. Sorry. Hopefully I'll find out more for a later post, because I'd like to solve this as well before I get desirous to compile and install a brand new release of MythTV.)
I made the following changes to mythlcdserver/lcdprocclient.cpp
:
Changed | To |
lcd_keystring = gContext->GetSetting("LCDKeyString", "ABCDEF"); | lcd_keystring = gContext->GetSetting("LCDKeyString", "A B C D E F"); |
aString = "client_del_key " + expandString(old_keystring); | aString = "client_del_key " + old_keystring; |
aString = "client_add_key " + expandString(lcd_keystring); | aString = "client_add_key " + lcd_keystring; |
Judging from the expandString
function, apparently lcdproc
used to take single-character "keys", all concatenated in one string (i.e. "ABCDEF"
representing six keys), whereas now it can use longer names, and the functions take a space-delimited list. My guess is that, in order to make MythTV compatible with old configuration values, they chose to stick to the single-character key designations and assume all configuration strings were such, and the expandString
function puts a space between each character (if lcdproc
is version 0.5 or higher). Some of the lcdproc
drivers even have a provision for mapping their keys to a single-letter designation. The driver for picoLCD does not, though. So, my solution is to make mythlcdserver
use key names instead of key letters, by simply removing the call to expandString
and treating the LCDKeyString value as a space-delimited string.
So far, I've had a bit of success. When I compiled mythlcdserver
with my changes and used a LCDKeyString value of "Plus Minus F1 F2 F3 F4 F5 Up Down Left Right Enter"
, I was actually able to control MythTV with the keypad. Sort of. The
+
key moved the menu selection up, and the
-
key selected the menu option. None of the other keys did anything (except after pressing all of them quickly to see if anything else would work, it stopped responding altogether; I suspect a bug in the picoLCD driver). When I changed the LCDKeyString value to "Up Down Left Right Enter", Up moved the cursor up and Down selected. So I have at least solved the problem of getting the keypad and the
mythlcdserver
program speaking the same language.
I have to say there is an annoyance that makes this whole process much more difficult, in that mythlcdserver
doesn't work from the command line. Oh, it starts all right. Even connects to MythTV and gets status updates. It just can't connect to LCDd
. I keep getting "connection refused" from LCDd
, whether I run as mythtv or as root. Can't figure out the problem there.
The reading of the key press appears to be handled by the library libmyth
, via lcddevice.cpp
. It is under the same assumption that the LCDKeyString value represents a list of non-delimited, single-character keys. In fact, the translation is done by taking the key name reported (actually just the first character thereof), finding the position it matches in LCDKeyString, and using that position as a "magic number" translation to a key press. Using my edited code, the key press for "Up" would cause it to look for a "U", find it at position 0, and translate that as Key_Up. "Down" caused it to find a "D" at position 3, thereby sending Key_Right (which happens to select a menu option).
To "fix" this, I am rewriting the LCD::handleKeyPress
function. It is, for the moment, quite simple:
void LCD::handleKeyPress(QString key_pressed) {
int key = 0;
if (key_pressed == "Up")
key = Qt::Key_Up;
else if (key_pressed == "Down")
key = Qt::Key_Down;
else if (key_pressed == "Left")
key = Qt::Key_Left;
else if (key_pressed == "Right")
key = Qt::Key_Right;
else if (key_pressed == "Enter")
key = Qt::Key_Space;
else if (key_pressed == "Plus")
key = Qt::Key_Home;
else if (key_pressed == "Minus")
key = Qt::Key_End;
else if (key_pressed == "F1")
key = Qt::Key_F1;
else if (key_pressed == "F2")
key = Qt::Key_X;
else if (key_pressed == "F3")
key = Qt::Key_I;
else if (key_pressed == "F4")
key = Qt::Key_Escape;
else if (key_pressed == "F5")
key = Qt::Key_M;
QApplication::postEvent(gContext->GetMainWindow(),
new ExternalKeycodeEvent(key));
}
I think there is oodles of room for improvement. Some way to map keys would be ideal. I was kind of hoping I could use the keybindings
table, maybe get the LCD module to report a key of, say, "LCD_UP", and have that text in the keybindings
table to identify what action LCD_UP performs. Maybe if I have time, I'll work on that. Right now, I'll just keep my fingers crossed for a clean [enough] compile, install the library, and see if I managed to make this thing usable.
And... It's no good. The front end never appeared, and the LCD showed LCDd
's default screen (0 clients). The mythfrontend.log
file gave me a clue, though:
sh: /usr/local/bin/mythlcdserver: No such file or directory
[...]
Couldn't find theme Titivillus
The big clue is that I have mythlcdserver
in /usr/bin/
, not /usr/local/bin/
. I'm going to hazard a guess that there is a path that gets compiled into the library that is different than the default KnoppMyth layout.