[mythtvnz] Keyboard & mouse/trackpad

Hadley Rich mythtvnz@lists.linuxnut.co.nz
Tue, 24 Jul 2007 11:30:09 +1200


--Boundary-00=_BoTpGhnJrvMaQxI
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Tue, 24 Jul 2007 11:22:27 Nick Rout wrote:
> I tend to use:
>
> 1. the remote for day to day functions.
>
> 2. ssh for admin (laptop on couch)
>
> 3. vnc for admin that involves typing characters into the myth interface
> (ditto)
>
> Doesn't help with web browsing on the TV though. I find myth a bit painful
> for that on the supplied interfaces.
>
> Not much good for fiddling with the bios either, but on the rare occasion
> that I needed that I have plenty of wired keyboards around.

I've attached another option. I use this with the laptop on the couch to send 
keypresses to mythfrontend. It works really well.

> I understand that the microsoft infra red MCE keyboard and remote will
> work via lirc-mod-mce
> http://www.gossamer-threads.com/lists/mythtv/users/279900

This apparently works really well and has a good range (I can imagine from the 
remotes range).

hads

-- 
http://nicegear.co.nz
New Zealand's VoIP supplier

--Boundary-00=_BoTpGhnJrvMaQxI
Content-Type: application/x-python;
  name="mythremote"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="mythremote"

#!/usr/bin/python -u

import os
import curses
import telnetlib

from time import sleep
from curses.wrapper import wrapper

HOST = 'frog'
PORT = 6546

keys = {
	9: 'tab',
	10: 'enter',
	27: 'escape',
	32: 'space',
	258: 'down',
	259: 'up',
	260: 'left',
	261: 'right',
	262: 'home',
	263: 'backspace',
	330: 'delete',
	331: 'insert',
	338: 'pagedown',
	339: 'pageup',
	353: 'backtab',
	360: 'end',
}

def main(screen):
	tn = telnetlib.Telnet(HOST, PORT)

	prompt = '\r\n# '
	tn.read_until(prompt, 2)
	while True:
		screen.addstr(0, 5, '-= MythTV console remote =-\n')
		c = screen.getch()
		if c in keys:
			s = 'key %s\n' % keys[c]
		else:
			s = 'key %s\n' % chr(c)
		screen.addstr(s)
		tn.write(s)
		r = tn.read_until(prompt, 2)
	curses.endwin()

wrapper(main)

--Boundary-00=_BoTpGhnJrvMaQxI--