Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Jan 2011 01:24:51 +0100
From:      Juergen Lock <nox@jelal.kn-bremen.de>
To:        freebsd-multimedia@FreeBSD.org
Cc:        hselasky@FreeBSD.org
Subject:   Using "LC Power LC-USB-DVBT" remote with vdr/webcamd (af9015.c patch)
Message-ID:  <20110123002451.GA65567@triton8.kn-bremen.de>

next in thread | raw e-mail | index | archive | help
Hi!

 Someone on irc pointed me to the "remote=" module parameter for the
dvb-usb-af9015 Linux driver so I tested it with this "LC Power
LC-USB-DVBT" tuner I got for a little more than ¤ 20 and indeed,
a value of 4 got the remote do something. [1]

 I then looked at the driver and found it has a table of device eprom
checksums to assign a default remote, so I added mine: [2]

	http://people.freebsd.org/~nox/dvb/webcamd/patch-af9015.c.txt

(patch also the end of this mail, it also has the pidfilter flag
I needed for my other dvb-t tuner that I talked about here:

	http://lists.freebsd.org/pipermail/freebsd-multimedia/2010-December/011509.html

)

 This tuner's remote attaches as an usb keyboard sendig mostly digits
and control characters, to use it with vdr on FreeBSD I did basically
the same as I did for the (bigger) usb remote that I originally
patched the vdr remote plugin for as I posted here:

	http://lists.freebsd.org/pipermail/freebsd-multimedia/2010-September/011240.html

(and also noted in the remote plugin's pkg-descr in the vdr shar),
i.e. I forced it to uhid(4) by adding a quirk UQ_KBD_IGNORE via
usbconfig:

	usbconfig add_dev_quirk_vplh 0x15a4 0x9016 0 0xffff UQ_KBD_IGNORE

and instead of unplugging it for a moment I then did an:

	usbconfig -d 5.3 reset

(of course replace 5.3 with whatever bus/addr your tuner comes up at.)

 My vdr's /usr/local/etc/vdr/remote.conf already had the config
for the other remote so with vdr stopped I backed that up,
removed the lines starting with remote-uhid0, touch(1)'ed
/usr/local/etc/vdr/channels.conf and then started vdr with

	'-Premote -h /dev/uhid0'

added to its args, started vdr-sxfe and tried to configure the
remote.  It's credit-card size and doesn't have up/down/left/right/menu/ok
and red/green/yellow/blue buttons so I had to use others for those
functions and I skipped a lot of less important other buttons too,
but at least it seems to work so far.  (When I originally tested
the remote I sometimes had a button `stuck on repeat' until i pressed
another one but for some reason that hasn't happened anymore at
least today...)

 I'll have to think more about a good mapping that makes the best
of the existing buttons and uses all the remaining ones that I
skipped, if anyone wants a remote.conf for this tuner I guess I
should do that first.

 And as mentioned in the remote plugin's pkg-descr you may need to
use an xorg.conf with

	Option          "AutoAddDevices" "False"

in Section "ServerFlags" (and possibly explicit InputDevice sections
for keyboard and mouse) to stop xorg from grabbing /dev/uhid0 too.
(Or maybe it also won't if you make sure vdr always starts before
xorg, but I guess then you can't restart vdr or plug in the tuner
later.  Or it's also possible you can set some hald(1) config to
make xorg ignore the remote...)

 Enjoy, :)
	Juergen

[1] webcamd doesn't handle runtime module parameters yet(?) so if
you want to do this on FreeBSD without my patch or with a different
module parameter or tuner you'll have to look up the module_param_named()
line in the driver source and set the variable named in the second
arg appropriately, i.e. in this case look for:

	module_param_named(remote, dvb_usb_af9015_remote, int, 0644);

and change the line

	static int dvb_usb_af9015_remote;

to

	static int dvb_usb_af9015_remote = 4;

[2] I also looked if I maybe should send the eprom checksum diff
upstream to the Linux v4l-dvb folks but found they now seem to use
a different git location:

	http://git.linuxtv.org/media_build.git

and the remote stuff in there has changed a bit.  Maybe I should look
at this again later...

 And here comes the /usr/ports/multimedia/webcamd/files/patch-af9015.c :

--- v4l-dvb/linux/drivers/media/dvb/dvb-usb/af9015.c.orig
+++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/af9015.c
@@ -832,6 +836,9 @@ static const struct af9015_setup af9015_
 	{ 0x9b7dc64e,
 		ir_codes_af9015_table_mygictv, ARRAY_SIZE(ir_codes_af9015_table_mygictv),
 		af9015_ir_table_mygictv, ARRAY_SIZE(af9015_ir_table_mygictv) },
+	{ 0x5d49e3db,
+		ir_codes_af9015_table_digittrade, ARRAY_SIZE(ir_codes_af9015_table_digittrade),
+		af9015_ir_table_digittrade, ARRAY_SIZE(af9015_ir_table_digittrade) },
 	{ }
 };
 
@@ -1465,6 +1472,9 @@ static struct dvb_usb_device_properties 
 		.adapter = {
 			{
 				.caps = DVB_USB_ADAP_HAS_PID_FILTER |
+#if 1
+				DVB_USB_ADAP_NEED_PID_FILTERING |
+#endif
 				DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
 
 				.pid_filter_count = 32,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110123002451.GA65567>