I've had two DVB-T 771's for almost a year now, previously running on R4V5. I had plenty of problems then, but quite a few less in R5A16
Anyway, here is the basic outline of how to get the remote working. I'm not going to go over the details of how to get the card driver module to load, how to tune channels or anthing else related to making the card show live television. That's been covered in many other posts in this forum. Search is your friend.
So assuming that you can actually use your card (can view TV) then it means the driver modules are loaded (dvb-bt8xx, mt352m bttv). This is important because it also means that the module controlling the remote is operating (bttv I think)
Now there is sketchy information about how to make the remote work.
lirc vs ir-kbd-gpio
In my previous attempt to get this card working, I went for the ir-kbd-gpio
module which is a kernel module that makes the remote emulate a keyboard. This is all well and good, but it introduces two problems.
1. The keycode mappings are set inside the module source (I recompiled the source at some point in the past so I know this), and if you don't like them, you need to fiddle with them in source and recompile your kernel module (a pain in the backside).
2. Not all the keys are mapped to useful codes, and not all codes are recognised by the X-server keyboard routines, so you won't have access to all the buttons.
Aside from the above two issues, it's dead easy to get ir-kbd-gpio to work, and in my brief read over the source code in the R5A16 kernel, it's enabled by default for the 771. Once it's loaded, you then create an xmodmap file to map the relatively useless keycodes picked up by ir-kbd-gpio into more useful codes recognised by mythtv, and then invoke mythtv with the xmodmap applied.
But that's all I'll say on ir-kbd-gpio I WONT ANSWER ANY QUESTIONS ON IT, because I covered that last year, look for one of my earlier posts. The main reason I don't cover ir-kbd-gpio any more is that lirc is significantly better.
Huh, I thought ir-kbd-gpio is lirc?
Nope. Too many people (me included) have confused the two. ir-kbd-gpio has NOTHING to do with lirc.
The key reasons why you want to use lirc instead of the kernel ir kbd module are as follows.
1. all the keys on the remote can be registered and used
2. each different program that has the foreground of your mythtv window, can have a different mapping for the remote keys (e.g. xine, mplayer and mythtv can all use the same key for different things). You can't do this with the ir kbd gpio module
OK then. I'll assume you now understand where I'm going to go with this. The remainder of this post is about how to make LIRC work with the avermedia DVB-T 771.
1. get the source of lirc (not via apt-get), but from the lirc site
http://www.lirc.org
example...
Code:
#cd /usr/src
#wget http://optusnet.dl.sourceforge.net/sourceforge/lirc/lirc-0.7.2.tar.bz2
unzip and untar it
2. change into the lirc source directory and run the setup.sh script.
3. select TV card and choose the avermedia TV98 card (I think it is number 2 on the avermedia list)
4. Save and run configure
5. Compile and install it
Code:
#make
#make install
Now if you were paying attention you might have noticed that it created a module called lirc_gpio which is what we are going to use to access our avermedia card.
Now it gets a bit trickier
6. create a file lirc_gpio in /etc/modprobe.d and put the following in it
Code:
# modprobe options for lirc_gpio module
alias char-major-61 lirc_gpio
options lirc_gpio gpio_mask=0xf00f0 gpio_lock_mask=0x20 gpio_xor_mask=0xf00f0 soft_gap=0 sample_rate=10
7. Save and type
Code:
#modprobe lirc_gpio
8. If it worked OK you should see something nice on your screen like
lirc_gpio (0): driver registered
If it bombs out with a message about an unrecognised card type 0x771 then it hasn't picked up the module parameters we entered above in the modprobe.d directory. You can manually do the same thing by typing
Code:
#modprobe lirc_gpio gpio_mask=0xf00f0 gpio_lock_mask=0x20 gpio_xor_mask=0xf00f0 soft_gap=0 sample_rate=10
and if that still fails, then it might mean you compiled lirc_gpio for the wrong driver, your card really isn't a DVB-T 771 or something else that I can't think of.
9. Now to check that it's worked,
Code:
#cat < /dev/lirc
You should be able to press your remote buttons and see some garbage on screen. If you don't and have two capture cards, then switch the remote dongle to the other capture card and try again.
10. Now you need to configure the lirc daemon so that it can read this garbage and do something constructive with it. To do this you need to tell the lircd about your remote, the buttons on it and so forth. I did this by creating an lircd.conf file with the irrecord program (you can see a default one in /etc/lirc/lircd.conf). The contents of my file are as follows.
Code:
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.7.1pre2(any) on Mon Aug 15 15:03:15 2005
#
# contributed by Simon Glynn
#
# brand: Avermedia DVB-T 771
# model no. of remote control:
# devices being controlled by this remote:
#
begin remote
name myremote
bits 8
eps 30
aeps 100
one 0 0
zero 0 0
gap 199890
toggle_bit 0
begin codes
source 0x7D
teletext 0xBD
power 0xFD
1 0x75
2 0xB5
3 0x35
4 0x6D
5 0xAD
6 0x2D
7 0x65
8 0xA5
9 0x25
0 0x5D
audio 0xED
full-screen 0xE5
preview 0xDD
loop 0x1D
display 0x9D
backward 0x55
forward 0x95
capture 0x15
mute 0xD5
play 0xCD
stop 0x0D
pause 0x8D
record 0x4D
red 0x45
green 0x79
ok 0xC5
cancel 0xF9
volume- 0x85
volume+ 0x05
channel- 0xB9
channel+ 0x39
end codes
end remote
Note: the names of the keys are names that I assigned when I created the file. The rest of this howto assumes the above names for keys or it won't work.
11. The 2nd part of this is the hardware.conf file (also in /etc/lirc/)
Replace it with the following (make backups)
Code:
# /etc/lirc/hardware.conf
#Try to load appropriate kernel modules
LOAD_MODULES=true
# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="default"
# If DEVICE is set to /dev/lirc and devfs is in use /dev/lirc/0 will be
# automatically used instead
DEVICE="/dev/lirc"
MODULES="lirc_dev lirc_gpio"
12. Now configure the startup script for knoppmyth so that it loads the correct lircd with the correct lircd.conf file (Note, that because you have installed lirc from source, there are probably two versions of lircd floating around your system (type whereis lircd to see what I mean). I don't think it matters which one you kick off, but each one will assume a different location for it's default lircd.conf file, so you need to make sure that you explicitly specify which lircd.conf file should be used by invoking lircd with the config file specified at the command line.
edit the following file
/etc/init.d/bootmisc.sh (save a backup)
add the following line to the end of it
Code:
/usr/local/sbin/lircd /etc/lirc/lircd.conf
edit /etc/modules
add lirc_gpio to the end of the file, save and exit.
13. Now we're nearing the end. lircd will pick up the remote key presses for your remote and be looking to do something with them. To know whether it is operating correctly, you can start lircd with the correct lircd.conf file at the command line and then type
irw and it should show the keypresses of the remote, but if you think everything is working OK then it's time to reboot. Make sure that when you mythbox comes back up that both the lirc_gpio module is loaded, and that the lircd daemon has started.
Code:
lsmod | grep lirc
should show lirc_gpio is loaded
Code:
ps -A | grep lircd
should show lircd in the list of running processes. If it doesn't then check dmesg for errors relating to the lirc_gpio module, as lircd shouldn't start without the lirc_gpio module loaded.
14. Your remote still won't do anything useful, that's because there is a final mapping step. You need to now tell lircd to map the received remote keypress into an application level command. This is done with the ~/.mythtv/lircrc file in the mythtv user home directory. Edit this file and put the following in it. (personal taste here. If you want different mappings, change as necessary).
Code:
# lircrc.Avermedia dvb-t 771
#
#
# Save this file in ~/.mythtv/lircrc
begin
prog = mythtv
button = cancel
config = Esc
end
#begin
# prog = mythtv
# button = Go
## Swap the PiP windows
# config = N
#end
begin
prog = mythtv
button = 1
config = 1
end
begin
prog = mythtv
button = 2
config = Up
repeat=32
end
begin
prog = mythtv
button = 3
config = 3
end
#begin
# prog = mythtv
# button = 4
# config = 4
#end
#begin
# prog = mythtv
# button = 5
# config = 5
#end
#begin
# prog = mythtv
# button = 6
# config = 6
#end
begin
prog = mythtv
button = 7
config = 7
end
begin
prog = mythtv
button = 8
config = Down
repeat=32
end
begin
prog = mythtv
button = 9
config = 9
end
begin
prog = mythtv
button = 0
config = 0
end
begin
prog = mythtv
button = display
config = M
end
begin
prog = mythtv
# We'll use it for "Delete"
button = red
config = D
end
begin
prog = mythtv
# We'll use it for "Information"
button = green
config = I
end
# Note the "repeat =" strings in the volume and channel.
# This means that if you hold down the key, every nth instance will be
# passed. This depends on your system, so you may want to increase or
# decrease this and see what happens. repeat = 1 is probably too
# fast.
begin
prog = mythtv
# Use it as a volume key
button = volume-
repeat = 16
config = F10
end
begin
prog = mythtv
# Use it as a volume key
button = volume+
repeat = 16
config = F11
end
begin
prog = mythtv
button = channel+
repeat = 32
config = Up
end
begin
prog = mythtv
button = channel-
repeat = 32
config = Down
end
begin
prog = mythtv
button = 4
repeat = 32
config = Left
end
begin
prog = mythtv
button = 6
repeat = 32
config = Right
end
begin
prog = mythtv
button = 5
config = Return
repeat=32
end
#same config for OK and 5 buttons
begin
prog=mythtv
button=ok
config=Return
repeat=32
end
begin
prog = mythtv
button = mute
config = F9
end
#begin
# prog = mythtv
# button = backward
# config = Left
#end
begin
prog = mythtv
button = play
config = P
end
#begin
# prog = mythtv
# button = forward
# config = Right
#end
begin
prog = mythtv
button = record
config = R
end
begin
prog = mythtv
button = stop
config = Esc
end
begin
prog = mythtv
button = pause
config = P
end
begin
prog = mythtv
button = backward
# Use for backwards commercial skip
config = Q
end
begin
prog = mythtv
button = forward
# Use for forward commercial skip
config = Z
end
############################MPLAYER###################################
#MPlayer
begin
prog = mplayer
button = cancel
config = quit
end
begin
prog = mplayer
button = display
config = osd
end
begin
prog = mplayer
button = 4
config = seek -10
repeat = 0
end
begin
prog = mplayer
button = 6
config = seek +10
repeat = 0
end
begin
prog = mplayer
button = 8
config = seek -60
repeat = 0
end
begin
prog = mplayer
button = 2
config = seek +60
repeat = 0
end
begin
prog = mplayer
button = pause
config = pause
end
begin
prog = mplayer
button = play
config = pause
end
begin
prog = mplayer
button = cancel
config = quit
end
begin
prog = mplayer
button = volume+
config = volume +1
repeat = 16
end
begin
prog = mplayer
button = volume-
config = volume -1
repeat = 16
end
begin
prog=mplayer
button=mute
config=mute
end
###################XINE######################################
begin
prog = xine
button=2
config=EventUp
repeat=32
end
begin
prog=xine
button=8
config=EventDown
repeat=32
end
begin
prog=xine
button=4
config=EventLeft
repeat=32
end
begin
prog=xine
button=6
config=EventRight
repeat=32
end
begin
prog=xine
button=5
config=EventSelect
repeat=32
end
begin
prog=xine
button=display
config=Menu
repeat=32
end
begin
prog=xine
button=loop
config=RootMenu
repeat=32
end
begin
prog=xine
button=backward
config=EventPrior
repeat=32
end
begin
prog=xine
button=forward
config=EventNext
repeat=32
end
begin
prog=xine
button=cancel
config=Quit
repeat=32
end
begin
prog=xine
button=volume+
config=Volume+
repeat=16
end
begin
prog=xine
button=volume-
config=Volume-
repeat=16
end
begin
prog=xine
button=teletext
config=ZoomIn
repeat=16
end
begin
prog=xine
button=source
config=ZoomOut
repeat=16
end
begin
prog=xine
button=green
config=ZoomReset
repeat=32
end
begin
prog=xine
button=play
config=Play
repeat=32
end
begin
prog=xine
button=pause
config=Pause
repeat=32
end
begin
prog=xine
button=channel+
config=SeekRelative+60
repeat=32
end
begin
prog=xine
button=channel-
config=SeekRelative-60
repeat=32
end
begin
prog=xine
button=mute
config=Mute
repeat=32
end
Now Ctrl-Alt-Backspace (or reboot) to restart X and the gdm, and therefore reload the lircrc file, point your remote at the dongle, and away you go.
I hope that helps someone. I'm still fine tuning my file, but it's a start. Just so you don't lose the plot wondering why your number keys aren't doing anything useful, I don't use the number keys for numbers. I use them to navigate (i.e. 2 = up, 8 = down, 4 = left and 6 = right and 5 = enter). If you really want numbers and navigation controls at the same time, then you'll need to be creative. This remote is a bit poor for this purpose. It could really benefit from a dedicated navigation pad.
Something else to note is the repeat and delay options in the lircrc file. repeat=x means that when you press a key on the remote, the next x repeats of the key will be ignored. The x+1th repeat will be considered the next remote keypress. The avermedia remote has a really fast repeat rate, and you might feel that the best option is to set the repeat value to 0 (which is the default and means ignore all repeats). The problem I'm having with this setting is that because there isn't a toggle bit on the remote data stream (i.e. because there isn't a signal to indicate that a key has been released) the repeat=0 option tends to wait for too long before considering the remote key to be non-repeating (i.e. to have been released and re-pressed), and consequently if you're using the keys to navigate, pressing the up button a number of times (e.g. 2..2..2..2) will result in some of the keypresses being considered repeats and therefore being ignored (i.e. get's interpreted as 2.. repeat-ignore.. 2..repeat-ignore ..)
So the repeat=16 or repeat=32 value provides a short enough cycle time that you can release and re-press a key over a fairly short duration and it will be considered a new key press not a repeat. Sorry if that didn't make a lot of sense, I'll try to explain it better if someone asks. If anyone knows whether the default cycle time can be altered it would make repeat=0 a more usable option and make lircrc file maintenance far easier.
Regards
simon
[/code]