Difference between revisions of "KWorld Global TV Terminator"

From MythTV Official Wiki
Jump to: navigation, search
(Video)
(HOWTO with Mythdora 4.0)
Line 74: Line 74:
 
</pre>
 
</pre>
  
== HOWTO with Mythdora 4.0 ==
+
== HOWTO with Mythdora ==
 +
This is a How To for setting this card up in MythDora(specifically 4.0). Much of this was taken from the wiki already and this is just here to make it easier to decipher which commands should be used and also to show that it works when hardware shopping.
  
 
===Video===
 
===Video===

Revision as of 17:42, 3 August 2007

General

(Version: VS-LTV7131RF) This (very inexpensive) card has been successfully set up on FC6. Also has an FM tuner and an IR receiver and remote. The MSI TV@nywhere Plus PCI is nearly identical to the KWorld Global TV Terminator.

Card information:

# lspci -v
06:02.0 Multimedia controller: Philips Semiconductors SAA7133/SAA7135 Video Broadcast Decoder (rev d1)
        Subsystem: Philips Semiconductors Unknown device 0000
        Flags: bus master, medium devsel, latency 32, IRQ 18
        Memory at 50004800 (32-bit, non-prefetchable) [size=2K]
        Capabilities: [40] Power Management version 2

Audio capture device information:

# arecord -l
card 1: SAA7134 [SAA7134], device 0: SAA7134 PCM [SAA7134 PCM]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Assuming your soundcard is card 0 add the following to /etc/modprobe.conf:

options saa7134 card=65 tuner=54
alias snd-card-1 saa7134-alsa
options snd-card-1 index=1
remove saa7134-alsa { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove saa7134-alsa

Use v4lctl to display/set the card attributes:

[root@sandbox ~]# v4lctl list
attribute  | type   | current | default | comment
-----------+--------+---------+---------+-------------------------------------
norm       | choice | NTSC    | PAL     | PAL PAL-BG PAL-I PAL-DK NTSC SECAM PAL-M PAL-Nc PAL-60
input      | choice | Televis | Televis | Television Composite1 S-Video
audio mode | choice | mono    | mono    | mono stereo lang1 lang2
bright     | int    |     127 |     128 | range is 0 => 255
contrast   | int    |      67 |      68 | range is 0 => 127
color      | int    |      63 |      64 | range is 0 => 127
hue        | int    |       0 |       0 | range is -128 => 127
volume     | int    |      12 |       0 | range is -15 => 15
mute       | bool   | off     | off     |
Mirror     | bool   | off     | off     |
Invert     | bool   | off     | off     |
y offset o | int    |       0 |       0 | range is 0 => 128
y offset e | int    |       0 |       0 | range is 0 => 128
automute   | bool   | on      | on      |

If you setup saa7134-alsa as card 1 you will refer to it as /dev/dsp1 in mythtv-setup when setting up the capture card.

+-------------+-------------+----------+--------------+----------------+
| videodevice | audiodevice | cardtype | defaultinput | audioratelimit |
+-------------+-------------+----------+--------------+----------------+
| /dev/video0 | /dev/dsp1   | V4L      | Television   |          32000 |
+-------------+-------------+----------+--------------+----------------+

Remote

The remote has 36 buttons of which 32 send unique codes. The remote is not fully supported in the 2.6.18 kernel but the knowledge exists on how to get it working. It is apparently a combined GPIO/i2c remote and a patch has been posted to the v4l mailing list and modified a few times for similar remotes (see Henry Wong patch). There are changes needed in the ir-kbd-i2c and saa7134 modules. So far I've modified and applied the patch and have it working at the linux input layer level. I'll update with full details after I have it fully working with LIRC.

Here are alternative versions of Henry Wong's patch: Ubuntu Feisty Debian Etch

Problems

Video but no sound? You may need to turn the volume up on the capture. Assuming /dev/dsp1 again run the following command:

[root@sandbox ~]# alsamixer -c 1

Not working in MythTV? Try it with mplayer. If this works (you may need to modify device, chanlist, adevice, or norm) then you have MythTV misconfigured somehow.

mplayer tv://"insert channel" -tv driver=v4l2:device=/dev/video0:chanlist=us-cable:alsa:\
adevice=hw.1,0:amode=1:audiorate=32000:forceaudio:volume=100:immediatemode=0:norm=NTSC

HOWTO with Mythdora

This is a How To for setting this card up in MythDora(specifically 4.0). Much of this was taken from the wiki already and this is just here to make it easier to decipher which commands should be used and also to show that it works when hardware shopping.

Video

Uses the saa7134 driver, which will automatically be loaded by Mythdora, but you need to pass the parameters card=65 tuner=54 when the module is loaded. To do this automatically, create a file called saa7134 in /etc/modprobe.d/ with the following contents:

options saa7134 card=65 tuner=54

Now every time the module is loaded, it will be passed these parameters.

You should now see your card show up in the Mythtv setup of capture cards.

I am not certain that this is correct, but I used it as a V4L capture card and it worked.

Audio

Unlike Knoppmyth Mythdora uses the saa7134-alsa module. However it usually starts with the volume turned all the way down. Use the fix below to adjust the sound of the card:

Video but no sound? You may need to turn the volume up on the capture. Assuming /dev/dsp1 again run the following command:

[root@sandbox ~]# alsamixer -c 1

HOWTO with KnoppMyth

This is a mini HOWTO for getting the video, audio, and remote of the KWorld Global TV Terminator working with KnoppMyth (specifially, version 5E50). The information may be useful to other distributions. It was created on Feb 20, 2007.

Video

Uses the saa7134 driver, which will automatically be loaded by KnoppMyth, but you need to pass the parameters card=65 tuner=54 when the module is loaded. To do this automatically, create a file called saa7134 in /etc/modprobe.d/ with the following contents:

options saa7134 card=65 tuner=54

Now everytime the module is loaded, it will be passed these parameters.

That's it for video. You should now see your card show up in the KnoppMyth setup of capture cards.

Audio

A lot of the documentation I found said to use the saa7134-alsa module for sound; this module is not loaded by KnoppMyth by default, and I found that when I loaded it, it caused a kernel panic.

However, there is another module that provides sound for the saa7134 and that is saa7134-oss. This module worked great for me.

Loading this module should create /dev/dsp1 (or a higher number if another device is already using /dev/dsp1). You need to tell KnoppMyth to use this audio device in the capture card setup.

By default, the sound may be muted, the volume may be too low, and automute may be on (not sure what effect automute has). In order to ensure these settings allow sound to come through, you need to use the video4linux 2 control utility (v4l2-ctl) to change them:

# v4l2-ctl --set-ctrl=mute=0
# v4l2-ctl --set-ctrl=volume=10
# v4l2-ctl --set-ctrl=automute=0

This should be it to get audio working, but you'll probably want these steps to be taken every time the computer boots. To do this, I placed the following lines in /etc/init.d/rc.local (after the line ". /lib/lsb/init-functions"):

modprobe saa7134-oss
v4l2-ctl --set-ctrl=mute=0
v4l2-ctl --set-ctrl=volume=10
v4l2-ctl --set-ctrl=automute=0

and then added rc.local to the system startup by issuing the command:

# update-rc.d rc.local defaults

Remote

The remote is the most difficult piece to get to work. It requires patching the kernel.

In order to do this, you need to download the kernel source, which can be found at ftp://knoppmyth.net/R5/linux-source-2.6.18-chw-13_2.6.18-chw-13-10.00.Custom_all.deb

Install it with:

# dpkg -i linux-source-2.6.18-chw-13_2.6.18-chw-13-10.00.Custom_all.deb

This will create a .tar.bz2 file containing the source in /usr/src/ . Untar this file.

Now you'll need to apply some patches.

The heavy lifting is done by a patch by Henry Wong. I've modified it so that it applies cleanly to the kernel source we are working with. I've broken it into 5 parts:

KWorld_Global_TV_Terminator remote_control_part1.patch

KWorld_Global_TV_Terminator remote_control_part2.patch

KWorld_Global_TV_Terminator remote_control_part3.patch

KWorld_Global_TV_Terminator remote_control_part4.patch

KWorld_Global_TV_Terminator remote_control_part5.patch

You can apply these by cd'ing to the /usr/src/linux-source-2.6.18-chw-13 directory and running:

# patch -p1 < remote_control_part1.patch
# patch -p1 < remote_control_part2.patch
# patch -p1 < remote_control_part3.patch
# patch -p1 < remote_control_part4.patch
# patch -p1 < remote_control_part5.patch

This patch is successful in getting events delivered from the remote control. However, they always had the same keycode on my system and were thus useless.

In order to fix this, I wrote a patch which is a total hack. It results in a remote control that mostly works. Some buttons don't work and keypresses don't always register, but it's usable. You can find the patch here:

KWorld_Global_TV_Terminator rc_hack.patch

Note that this patch hacks part of the infrared subsystem, so you may want to be especially wary of using it if you have other infrared devices.

Apply this patch the same way you did the other patches:

# patch -p1 < rc_hack.patch

Now you'll need to recompile the kernel modules, but before you do this, you should backup your current modules (located in /lib/modules/2.6.18-chw-13). One way to do this is to move this directory to 2.6.18-chw-13.old . That way, restoring the modules is simply a matter of renaming it back.

Now go into /usr/src/linux-source-2.6.18-chw-13 and type "make menuconfig".

Scoll down and select "load an alternate configuration file".

Specify the file "/boot/config-2.6.18-chw-13".

Save and exit.

Compile the modules and install them in /lib/modules/2.6.18-chw-13 by typing "make modules && make modules_install".

Now run "depmod" to generate symbol information in the /lib/modules/2.6.18-chw-13 directory.

Go ahead and reboot. The modules important to the remote control should be automatically loaded by KnoppMyth.

If everything goes well you should be able to open a terminal, press the 1 key on your remote and see a 1 appear in the terminal (make sure that num lock is on).

You'll now have the following keys working and generating the following X keycodes:

power 222
scan 229
mute 160
recall 133
stop 232
play 179
<< 234
function 158
>> 233
vol+ 176
vol- 174
minimize 175
1 87
2 88
3 89
4 83
5 84
6 85
7 79
8 80
9 81
0 90
+ 86

In order for mythtv to make sense of these keys, you'll want to use xmodmap to map the keycodes to well-known keysyms. To do this, you need to create a file called /home/mythtv/.Xmodmap and you need to run "xmodmap /home/mythtv/.Xmodmap" every time X starts.

My .Xmodmap looks like this:

! power
keycode 222 = F1
! scan
keycode 229 = F2
! mute
keycode 160 = F3
! recall
keycode 133 = F4
! stop
keycode 232 = F5
! play
keycode 179 = F6
! <<
keycode 234 = F7
! function
keycode 158 = F8
! >>
keycode 233 = F9
! vol+
keycode 176 = F10
! vol-
keycode 174 = F11
! min
!keycode 175 = F12
keycode 175 = Return

! keypad
keycode 81 = 9
keycode 80 = 8
keycode 79 = 7
keycode 85 = 6
keycode 84 = 5
keycode 83 = 4
keycode 89 = 3
keycode 88 = 2
keycode 87 = 1
keycode 90 = 0
! plus
keycode 86 = equal

To get xmodmap to run every time X starts, I added the following line to /home/mythtv/.fluxbox/apps after the line "[startup] {xset -dpms s off}":

[startup] {xmodmap ~/.Xmodmap}

Now restart X to get the new mappings to load (ctrl-alt-backspace should do the trick).

mythtv should recognize the keys as if you pressed the corresponding key on the keyboard (Utilities/Setup->Edit Keys is where you bind keys to functions in mythtv BTW).

Resources