Chinaunix

标题: [技术共享]TV Card(saa7130HL)+遥控支持 for Debian [打印本页]

作者: wrxzzj    时间: 2006-05-05 23:28
标题: [技术共享]TV Card(saa7130HL)+遥控支持 for Debian
现在的linux的2.6内核里,对saa713x和bttv系列的电视卡提供了很不错的支持。
经本人好几天的辛苦捣鼓,终于把我的电视精灵2(芯片:saa7130HL)弄到linux上了。
特将本人心得与大家分享。
我的环境是2.6.16,最新的kernel。
一般的PCI电视卡,在2.6.x系列的kernel上,均可以自己认出。不过你需要就是在insmod的时候,指定card=xxx,tuner=xxx
这很重要的,默认的值都不大对的,需要自己手工调的。
这几个值,可以参照linux内核的Documents/video4linux/CARDLIST.xxxx文档。
假如我们要在开机的时候,自己让系统insmod你的模块,只需在创建/etc/modprobe.d/saa7134文件,把你的设置写进去就可以了。我的saa7134内容:
options saa7134 card=21,21,21,21 tuner=38,38,38,38 video_nr=0,1,2,3 vbi_nr=0,1,2,3 radio_nr=0,1,2,3
install saa7134 /sbin/modprobe --ignore-install saa7134; /sbin/modprobe saa7134-alsa
options saa7134-alsa index=1,2,3,4
这样你的linux重启后,就可以用tvtime来看电视了。这很简单哦,呵呵。
由于遥控器都是厂家自己定制的,所以在Kernel里一般没有得到很好的支持。要自己动手改saa7134的驱动代码,搞起来比较累。像我的天敏出品的就没有支持的,只好自己动手了。
saa7134 通过ir_kbd_i2c 模块把ir 信号转成Keyboard信号。
下面这段文章很有用的,如果要支持Remote Control的话,一定要好好看。
How to add remote control support to a card (GPIO remotes)

The operation is as follows (at least it is how i did it):

1. you make detinitions of your board to have remote control (in saa7134-cards.c).
2. in saa7134-input.c, you add a case for it into the switch statement, with mask_keycode=0. Use any ir_codes array for the start. Well, you should also determine whenever polling is needed, too.
3. Load saa7134 module with ir_debug=1 parameter.
4. press the keys on your remote control and watch syslog (dmesg). You will see something like
build_key gpio=0x12345 mask=0x0 data=0

in dmesg output after each key press/release.

Pay attention to gpio=0x... stuff. You will see some bits which does not change, and some which do. The ones which changes should be in your mask_keycode and mask_keydown (mask_keycode should contain not more than 8 bits set to 1, others should be set to 0). Mask_keyup and mask_keydown - those are easy to determine if you see some bit is always on when you press a key and off when you release it, or the reverse.

Ie, you will have to determine which bits in gpio value represents the key# pressed/released, and which indicate whenever it is the press or release.

After this, recompile saa7134 module with correct mask_* stuff in your saa7134_input_init1() routine. Now, the dmesg output should look like

build_key gpio=0x12345 mask=0x<mask_value> data=5

Ensure the data= value is different for each key, if not, you'll have to modify mask_keycode again.

Next, build the key table, by writing a file with one line for every of your key, with two fields -- key name and the data=value assotiated with it.

Try to find existing table matching your one. If there's one, use it. If none is found, build your own.

That's basically it.
以上内容来自V4L的Wiki http://linuxtv.org/v4lwiki/index.php/Remote_controllers,很有帮助的。
主要是调整mask_keycode和mask_keyup这几个值,比较累。没有厂家的资料,我们自己猜,呵呵。
修改好,重新make modules; make modules_install即可。
作者: david.joe    时间: 2006-07-13 20:54
老兄,偶是菜鸟,装的是fc4,偶用的也是精灵2代,现在装了个tvtime,碰到问题,就是不知道怎么在哪设置card和tuner,我/etc目录下面没有modprobe.d这个目录啊,要自己建???还是???
作者: wrxzzj    时间: 2006-11-22 15:00
标题: 回复 1楼 wrxzzj 的帖子
看到大家都在装电视卡,我把我的帖子顶一下,希望对大家有帮助,希望楼主加精。
作者: freecutelei    时间: 2006-11-24 10:03
天敏电视精灵很简单的
直接modprobe saa7134 card=3就认了,自动认成tuner=37
效果还不错
呵呵




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2