1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-01 05:45:45 +00:00
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 or reset it via usbconfig,
    0x1241 there is the vendor id, 0xe000 the product id of the
    device, you can get yours by doing

	usbconfig -d 1.2 dump_device_desc

    and looking for idVendor and idProduct, -d 1.2 there corresponds
    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.

    2nd note:  If vdr cannot open your uhid device check it is not claimed
    by xorg:

	fstat |grep uhid

    If it is you may need an xorg.conf(5) with manually defined
    InputDevice sections for mouse and keyboard and

	Option		"AutoAddDevices" "False"

    in the ServerFlags section.

    And if for some reason you want to reassign the buttons on the
    remote you can stop vdr and do:

	touch /usr/local/etc/vdr/channels.conf

    and/or remove uhid entries from

	/usr/local/etc/vdr/remote.conf .

    When you then start vdr again it should ask to configure the
    remote again.

WWW: http://escape-edv.de/endriss/vdr
This commit is contained in:
Juergen Lock 2011-03-26 19:19:38 +00:00
parent a4dcbee078
commit a90cfac7f1
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=271805
7 changed files with 380 additions and 0 deletions

View File

@ -342,6 +342,7 @@
SUBDIR += vdr-plugin-iptv
SUBDIR += vdr-plugin-osdpip
SUBDIR += vdr-plugin-osdteletext
SUBDIR += vdr-plugin-remote
SUBDIR += vic
SUBDIR += vlc
SUBDIR += vodcatcher

View File

@ -0,0 +1,35 @@
# New ports collection makefile for: vdr-plugin-remote
# Date created: Sun Aug 29 18:11:42 CEST 2010
# Whom: Juergen Lock <nox@freebsd.org>
#
# $FreeBSD$
#
PORTNAME= vdr-plugin-remote
PORTVERSION= 0.4.0
PORTREVISION= 6
CATEGORIES= multimedia
MASTER_SITES= http://www.escape-edv.de/endriss/vdr/
DISTNAME= ${PORTNAME:S/-plugin-/-/}-${DISTVERSIONPREFIX}${DISTVERSION}${DISTVERSIONSUFFIX}
EXTRACT_SUFX= .tgz
MAINTAINER= nox@FreeBSD.org
COMMENT= Video Disk Recorder - remote control plugin
PATCH_STRIP= -p1
HAVE_CONFIGURE= yes
PORTDOCS= COPYING README
MAKE_JOBS_SAFE= yes
WRKSRC= ${WRKDIR}/${PLUGIN}-${DISTVERSION}
.include "${.CURDIR}/../vdr/Makefile.plugins"
post-patch: post-patch-plugin
post-install:
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
(cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR})
.endif
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (vdr/vdr-remote-0.4.0.tgz) = 402178a5ca34796621ec248fbc459c41d86e7ce7f226080b507aad3e054512bf
SIZE (vdr/vdr-remote-0.4.0.tgz) = 28397

View File

@ -0,0 +1,22 @@
--- a/Makefile
+++ b/Makefile
@@ -54,6 +54,12 @@ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I
DEFINES += -DREMOTE_FEATURE_LIRC
DEFINES += -DREMOTE_FEATURE_TCPIP
+ifeq ($(OSTYPE),FreeBSD)
+DEFINES += -DREMOTE_FEATURE_UHID
+else
+DEFINES += -DREMOTE_FEATURE_DEVINPUT
+endif
+
### The object files (add further files here):
OBJS = $(PLUGIN).o ttystatus.o
@@ -126,3 +132,6 @@ dist: clean
clean:
@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
@-rm -f *.o $(DEPFILE) *.so *.tgz core* *~
+
+install:
+ ${INSTALL_PROGRAM} $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) $(PREFIX)/lib/vdr/libvdr-$(PLUGIN).so.$(APIVERSION)

View File

@ -0,0 +1,255 @@
--- a/remote.c
+++ a/remote.c
@@ -15,7 +15,9 @@
#include <sys/fcntl.h>
#include <getopt.h>
#include <termios.h>
+#ifdef REMOTE_FEATURE_DEVINPUT
#include <linux/input.h>
+#endif
#include "i18n.h"
#include "remote.h"
#ifdef REMOTE_FEATURE_TCPIP
@@ -25,6 +27,9 @@
#define NUMREMOTES 10 // maximum number of remote control devices
+#ifdef REMOTE_FEATURE_UHID
+#define UHID_DEFAULT_READSIZE 8 // default size of uhid reads
+#endif
#define AV7110_KEYMAP_DEVICE "/proc/av7110_ir"
#if 0
@@ -183,6 +188,7 @@ void cRemoteGeneric::Action(void)
int identifyInputDevice(const int fh, char *name)
// ---------------------------------------------------------------------------
{
+#ifdef REMOTE_FEATURE_DEVINPUT
char description[256];
// check name of input device
@@ -196,11 +202,13 @@ int identifyInputDevice(const int fh, ch
if (strstr(description, "DVB") || strstr(description, "dvb"))
return 2;
+#endif
return 0;
}
+#ifdef REMOTE_FEATURE_DEVINPUT
// ---------------------------------------------------------------------------
bool cRemoteDevInput::loadKeymap(const char *devname, uint32_t options)
// ---------------------------------------------------------------------------
@@ -454,6 +462,68 @@ bool cRemoteDevInput::keyPressed(uint64_
{
return (code & 0xFFFF00000000ULL);
}
+#endif // REMOTE_FEATURE_DEVINPUT
+
+
+/*****************************************************************************/
+
+
+#ifdef REMOTE_FEATURE_UHID
+// ---------------------------------------------------------------------------
+cRemoteUhid::cRemoteUhid(const char *name, int f, char *d, int size)
+ :cRemoteGeneric(name, f, d)
+// ---------------------------------------------------------------------------
+{
+ Start();
+
+ readsize = size;
+ repeatcode = 0;
+ fcntl(f, F_SETFL, O_NONBLOCK);
+}
+
+
+// ---------------------------------------------------------------------------
+bool cRemoteUhid::Initialize()
+// ---------------------------------------------------------------------------
+{
+ return true;
+}
+
+
+// ---------------------------------------------------------------------------
+uint64_t cRemoteUhid::getKey(void)
+// ---------------------------------------------------------------------------
+{
+ int n;
+ uint64_t code = 0;
+
+ // XXX handle short reads properly on big-endian
+ n = read(fh, &code, readsize);
+ if (n <= 0) {
+ if (n < 0 && (errno == EAGAIN || errno == EINTR))
+ code = repeatcode;
+ else {
+ code = INVALID_KEY;
+ repeatcode = 0;
+ }
+ } else {
+ repeatcode = code;
+#if 1 //def PRINTFDEBUGGING
+ printf("code %jx\n", code);
+#endif
+ }
+
+ return code;
+}
+
+
+// ---------------------------------------------------------------------------
+bool cRemoteUhid::keyPressed(uint64_t code)
+// ---------------------------------------------------------------------------
+{
+ return ((code & ~0xffULL) != 0LL);
+}
+#endif // REMOTE_FEATURE_UHID
/*****************************************************************************/
@@ -557,6 +627,9 @@ private:
int devcnt;
char devtyp[NUMREMOTES];
char *devnam[NUMREMOTES];
+#ifdef REMOTE_FEATURE_UHID
+ int devsize[NUMREMOTES];
+#endif
int fh[NUMREMOTES];
public:
cPluginRemote(void);
@@ -604,6 +677,10 @@ const char *cPluginRemote::CommandLineHe
// ---------------------------------------------------------------------------
{
return " -i dev, --input=dev input device (/dev/input/... | autodetect)\n"
+#ifdef REMOTE_FEATURE_UHID
+ " -h dev, --uhid=dev uhid(4) device (/dev/uhidX)\n"
+ " -s size, --uhidsize=size uhid device read size\n"
+#endif
#ifdef REMOTE_FEATURE_LIRC
" -l dev, --lirc=dev lirc device (/dev/lircd)\n"
#endif
@@ -624,6 +701,10 @@ bool cPluginRemote::ProcessArgs(int argc
{
static struct option long_options[] =
{ { "input", required_argument, NULL, 'i' },
+#ifdef REMOTE_FEATURE_UHID
+ { "uhid", required_argument, NULL, 'h' },
+ { "uhidsize", required_argument, NULL, 's' },
+#endif
{ "lirc", required_argument, NULL, 'l' },
{ "port", required_argument, NULL, 'p' },
{ "tty", required_argument, NULL, 't' },
@@ -631,11 +712,20 @@ bool cPluginRemote::ProcessArgs(int argc
{ NULL } };
int c;
+#ifndef REMOTE_FEATURE_UHID
while ((c = getopt_long(argc, argv, "i:l:p:t:T:", long_options, NULL)) != -1)
+#else
+ while ((c = getopt_long(argc, argv, "i:h:s:l:p:t:T:", long_options, NULL)) != -1)
+#endif
{
+#ifdef REMOTE_FEATURE_UHID
+ int size;
+#endif
+
switch (c)
{
case 'i':
+ case 'h':
case 'l':
case 'p':
case 't':
@@ -647,8 +737,27 @@ bool cPluginRemote::ProcessArgs(int argc
}
devtyp[devcnt] = c;
devnam[devcnt] = optarg;
+#ifdef REMOTE_FEATURE_UHID
+ devsize[devcnt] = UHID_DEFAULT_READSIZE;
+#endif
devcnt++;
break;
+#ifdef REMOTE_FEATURE_UHID
+ case 's':
+ if (!devcnt || devcnt > NUMREMOTES)
+ {
+ esyslog("%s: uhidsize must come after uhid device", Name());
+ return false;
+ }
+ size = atoi(optarg);
+ if (size <= 0 || size_t(size) > sizeof (int64_t))
+ {
+ esyslog("%s: bad uhidsize %s", Name(), optarg);
+ return false;
+ }
+ devsize[devcnt] = size;
+ break;
+#endif
default:
esyslog("%s: invalid argument", Name());
@@ -671,6 +780,7 @@ bool cPluginRemote::Start(void)
RegisterI18n(remotePhrases);
#endif
+#ifdef REMOTE_FEATURE_DEVINPUT
// no device specified by the user, set default
if (devcnt == 0)
{
@@ -719,6 +829,7 @@ bool cPluginRemote::Start(void)
if (devtyp[i] == 'i' && strcmp(devnam[i], "autodetect") == 0)
devnam[i] = "/dev/input/ir";
} // for i
+#endif
for (int i = 0; i < devcnt; i++)
{
@@ -769,9 +880,17 @@ bool cPluginRemote::Start(void)
switch (devtyp[i])
{
+#ifdef REMOTE_FEATURE_DEVINPUT
case 'i':
new cRemoteDevInput(nam,fh[i],devnam[i]);
break;
+#endif
+
+#ifdef REMOTE_FEATURE_UHID
+ case 'h':
+ new cRemoteUhid(nam,fh[i],devnam[i],devsize[i]);
+ break;
+#endif
#ifdef REMOTE_FEATURE_LIRC
case 'l':
--- a/remote.h
+++ a/remote.h
@@ -82,6 +82,24 @@ public:
+#ifdef REMOTE_FEATURE_UHID
+/*****************************************************************************/
+class cRemoteUhid : protected cRemoteGeneric
+/*****************************************************************************/
+{
+private:
+ uint64_t repeatcode;
+ int readsize;
+protected:
+ virtual uint64_t getKey(void);
+ virtual bool keyPressed(uint64_t code);
+public:
+ cRemoteUhid(const char *name, int f, char *d, int size);
+ virtual bool Initialize(void);
+};
+#endif
+
+
#ifdef REMOTE_FEATURE_LIRCOLD
/*****************************************************************************/
class cRemoteDevLirc : protected cRemoteGeneric

View File

@ -0,0 +1,64 @@
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 or reset it via usbconfig,
0x1241 there is the vendor id, 0xe000 the product id of the
device, you can get yours by doing
usbconfig -d 1.2 dump_device_desc
and looking for idVendor and idProduct, -d 1.2 there corresponds
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.
2nd note: If vdr cannot open your uhid device check it is not claimed
by xorg:
fstat |grep uhid
If it is you may need an xorg.conf(5) with manually defined
InputDevice sections for mouse and keyboard and
Option "AutoAddDevices" "False"
in the ServerFlags section.
And if for some reason you want to reassign the buttons on the
remote you can stop vdr and do:
touch /usr/local/etc/vdr/channels.conf
and/or remove uhid entries from
/usr/local/etc/vdr/remote.conf .
When you then start vdr again it should ask to configure the
remote again.
WWW: http://escape-edv.de/endriss/vdr

View File

@ -0,0 +1 @@
lib/vdr/libvdr-remote.so.1.7.17