Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Sep 2010 00:21:04 +0200
From:      Juergen Lock <nox@jelal.kn-bremen.de>
To:        freebsd-multimedia@FreeBSD.org
Subject:   using remotes with vdr (patching remote plugin for uhid(4))
Message-ID:  <20100901222104.GA3552@triton8.kn-bremen.de>

next in thread | raw e-mail | index | archive | help
Since I now have a usb receiver with matching remote that comes up
as ukbd(4) and ums(4) (its sold sold for Windows MCE), I looked at
remote support for vdr again.  Since I didn't want to change the
ukbd rules in /etc/devd.conf and since there also may be dvb tuner
remotes that come up as uhid(4) instead of ukbd(4) (in addition to
those that are handled directly in the dvb drivers for which there
still is code missing in webcamd so they cannot easily be used by
apps yet), I added a quirk UQ_KBD_IGNORE via usbconfig add_dev_quirk_vplh
and tried to simply read from /dev/uhid0.  usbconfig dump_curr_config_desc
on the device says wMaxPacketSize is 0x0008 for both endpoints (ugen3.2.0
is handled by uhid0 according to `usbconfig show_ifdrv' so I guess
interface 0's endpoint is the `keyboard'), so I read 8 bytes each,
and got data for most of the remote's buttons at button press, and
8 bytes of zero at button release. (for some reason a few buttons like
volume up/down and mute didn't produce anything, apparenly not even on
other uvid devices when using the sysutils/uhidd port and usbhidctl.)

 Luckily the remote plugin uses 8 bytes for handling codes from
remotes too (uint64_t), so I added a cRemoteUhid class that basically
just returns the result of the last successful read (and reads with
O_NONBLOCK in order to support repeat), and returns true for
keyPressed() if code is not zero, and that got my remote going!

 So if anyone wants to test this with his remote, I've put the shar
of the patched remote plugin port here:

	http://people.freebsd.org/~nox/dvb/vdr-plugin-remote.shar

 And here is the pkg-descr with notes about how to add the quirk
if your remote comes up as ukbd(4) too:

--------snip-------
http://www.linuxtv.org/vdrwiki/index.php/Remote-plugin

This plugin extends the remote control capabilities of vdr.
The following remote control devices are supported:

(a) linux input device driver ('/dev/input/eventX', X=0,1,2,...)
    (currently not supported on FreeBSD)

(b) keyboard (tty driver): /dev/console, /dev/ttyX

(c) TCP connection (telnet)

(d) LIRC

(e) some(?) FreeBSD uhid(4) devices (experimental support added by this port)
    To use, add something like this to vdr_flags: '-Premote -h /dev/uhid0',
    (re)start vdr, then the osd should ask you to configure the
    remote by pressing the buttons you want to assign.

    Note:  If your remote is detected as a keyboard you'll have to
    tell ukbd(4) to ignore it first by doing (as root) something like:

	usbconfig add_dev_quirk_vplh 0x1241 0xe000 0 0xffff UQ_KBD_IGNORE

    (and possibly unplug it for a moment, 0x1241 there is the vendor
    id, 0xe000 the product id of the device, you can get yours by
    doing

	usbconfig -u 1 -a 2 dump_device_desc

    and looking for idVendor and idProduct, -u 1 and -a 2 there
    correspond to ugen1.2 listed by usbconfig w/o args.)

    You can check with:

	usbconfig show_ifdrv

    if the device is then listed as ugen...: uhid... you're good to go.

WWW: http://escape-edv.de/endriss/vdr
--------snip-------

 Happy testing!
	Juergen

PS: I meanwhile discovered <dev/usb/usbhid.h> so doing this `properly'
(by actually interpreting the data and hid descriptor etc) may be less
work than I initially thought, but first let's see how far ppl get with
this simple approach. :)



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