mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 07:23:09 +02:00
drivertool: add shortcuts to switch TD and CS remote
* add shortcut options for TD and CS remotes * use nevis_ir.h if present Needs testing frontpanel driver to work properly. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1547 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -90,6 +90,7 @@ if test "$enable_flac" = "yes"; then
|
|||||||
AC_DEFINE(ENABLE_FLAC,1,[include FLAC support])
|
AC_DEFINE(ENABLE_FLAC,1,[include FLAC support])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS(coolstream/nevis_ir.h)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check for libtdservicedb - the new one - for testing only
|
# Check for libtdservicedb - the new one - for testing only
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
* right now the frontpanel and the IR remote drivers are implemented
|
* right now the frontpanel and the IR remote drivers are implemented
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@@ -29,6 +30,10 @@
|
|||||||
|
|
||||||
#include <coolstream/cs_vfd.h>
|
#include <coolstream/cs_vfd.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_COOLSTREAM_NEVIS_IR_H
|
||||||
|
#include <coolstream/nevis_ir.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef IOC_IR_SET_PRI_PROTOCOL
|
#ifndef IOC_IR_SET_PRI_PROTOCOL
|
||||||
/* unfortunately, the shipped headers seem to be still incomplete...
|
/* unfortunately, the shipped headers seem to be still incomplete...
|
||||||
* documented here:
|
* documented here:
|
||||||
@@ -115,6 +120,10 @@ static struct ioctl_list n[] = {
|
|||||||
{ 1, "IR_SET_X_DELAY", IOC_IR_SET_X_DELAY, TYPE_UINT },
|
{ 1, "IR_SET_X_DELAY", IOC_IR_SET_X_DELAY, TYPE_UINT },
|
||||||
{ 1, "IR_SET_FP_MODE", IOC_IR_SET_FP_MODE, TYPE_UINT },
|
{ 1, "IR_SET_FP_MODE", IOC_IR_SET_FP_MODE, TYPE_UINT },
|
||||||
{ 1, "IR_GET_PROTOCOLS", IOC_IR_GET_PROTOCOLS, TYPE_UINT_GET },
|
{ 1, "IR_GET_PROTOCOLS", IOC_IR_GET_PROTOCOLS, TYPE_UINT_GET },
|
||||||
|
#ifdef HAVE_COOLSTREAM_NEVIS_IR_H
|
||||||
|
{ 1, "IOC_IR_SET_PRI_KEYMAP", IOC_IR_SET_PRI_KEYMAP, TYPE_UNSUPP },
|
||||||
|
{ 1, "IOC_IR_SET_SEC_KEYMAP", IOC_IR_SET_SEC_KEYMAP, TYPE_UNSUPP },
|
||||||
|
#endif
|
||||||
{ -1, NULL, 0, TYPE_UNSUPP }
|
{ -1, NULL, 0, TYPE_UNSUPP }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -154,6 +163,8 @@ void usage(void)
|
|||||||
printf("\t%-20s %s\n", n[i++].text, arg);
|
printf("\t%-20s %s\n", n[i++].text, arg);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
printf("shortcuts:\n\t-c\tswitch primary remote to coolstream\n"
|
||||||
|
"\t-t <n>\tswitch primary remote to Tripledragon addr <n>\n\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,6 +179,52 @@ int main(int argc, char **argv)
|
|||||||
if (argc < 2 || (argc > 1 && strcmp(argv[1], "-h") == 0))
|
if (argc < 2 || (argc > 1 && strcmp(argv[1], "-h") == 0))
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
if (argv[1][0] == '-')
|
||||||
|
{
|
||||||
|
ir_protocol_t p;
|
||||||
|
|
||||||
|
switch (argv[1][1])
|
||||||
|
{
|
||||||
|
case 't':
|
||||||
|
if (argc < 3)
|
||||||
|
usage(); /* does not return */
|
||||||
|
p = IR_PROTOCOL_RMAP_E;
|
||||||
|
a = (unsigned int) strtoll(argv[2], NULL, 0);
|
||||||
|
a <<= 16;
|
||||||
|
a |= 0x0A;
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
p = IR_PROTOCOL_NECE;
|
||||||
|
a = 0xFF80;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
|
||||||
|
fd = open(devices[1], O_RDONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
perror(devices[1]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
ret = ioctl(fd, IOC_IR_SET_PRI_PROTOCOL, p);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
perror("IOC_IR_SET_PRI_PROTOCOL");
|
||||||
|
ret = errno;
|
||||||
|
close(fd);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
ret = ioctl(fd, IOC_IR_SET_PRI_ADDRESS, a);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
perror("IOC_IR_SET_PRI_ADDRESS");
|
||||||
|
ret = errno;
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
while (n[i].text != NULL && strcmp(n[i].text, argv[1]) != 0)
|
while (n[i].text != NULL && strcmp(n[i].text, argv[1]) != 0)
|
||||||
i++;
|
i++;
|
||||||
|
Reference in New Issue
Block a user