From owner-freebsd-multimedia@FreeBSD.ORG Wed Sep 1 22:24:31 2010 Return-Path: Delivered-To: freebsd-multimedia@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB91B10656AA for ; Wed, 1 Sep 2010 22:24:31 +0000 (UTC) (envelope-from nox@jelal.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id 65F2C8FC21 for ; Wed, 1 Sep 2010 22:24:31 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id E4CCA1E006D8; Thu, 2 Sep 2010 00:24:29 +0200 (CEST) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.4/8.14.3) with ESMTP id o81ML5L3006049 for ; Thu, 2 Sep 2010 00:21:05 +0200 (CEST) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.4/8.14.3/Submit) id o81ML58s006048 for freebsd-multimedia@FreeBSD.org; Thu, 2 Sep 2010 00:21:05 +0200 (CEST) (envelope-from nox) From: Juergen Lock Date: Thu, 2 Sep 2010 00:21:04 +0200 To: freebsd-multimedia@FreeBSD.org Message-ID: <20100901222104.GA3552@triton8.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Subject: using remotes with vdr (patching remote plugin for uhid(4)) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2010 22:24:31 -0000 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 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. :)