You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lirc/lirc-cvs20051129.patch

406 lines
11 KiB

--- lirc-0.8.0pre1/configure.in.orig 2005-11-05 18:52:50.000000000 +0200
+++ lirc-0.8.0pre1/configure.in 2005-11-29 00:23:03.000000000 +0200
@@ -137,6 +137,7 @@
AC_MSG_RESULT()
possible_drivers="(none) \
+ (userspace)
(bte) \
(bw6130) \
(creative) \
@@ -164,7 +165,7 @@
if test x${no_kernel} != xyes; then
possible_drivers="${possible_drivers} \
- (any) \
+ (all) \
(lirc_dev) \
(lirc_dev lirc_atiusb) \
(lirc_dev lirc_bt829) \
@@ -301,9 +302,9 @@
HW_DEFAULT="hw_null"
fi
-if test "$driver" = "any"; then
+if test "$driver" = "userspace" -o "$driver" = "all"; then
AC_DEFINE(LIRC_DRIVER_ANY)
- lirc_driver="any"
+ lirc_driver=$driver
any_possible_drivers=`echo ${possible_drivers} | sed -e's/ /-/g' \
-e's/)-(/ /g' -e's/(//g' -e's/)//g' \
@@ -1039,7 +1040,7 @@
AC_MSG_ERROR([*** you need to first install the caraca package
before you can use this driver])
;;
- any|lirc_*)
+ all|lirc_*)
AC_MSG_ERROR([*** you need to have the Linux kernel source installed
for this driver])
;;
@@ -1078,6 +1079,7 @@
if test "$lirc_driver" = "none" || \
test "$lirc_driver" = "alsa_usb" || \
+ test "$lirc_driver" = "userspace" || \
test "$lirc_driver" = "atilibusb" || \
test "$lirc_driver" = "audio" || \
test "$lirc_driver" = "audio_alsa" || \
@@ -1085,7 +1087,7 @@
test "$lirc_driver" = "irman" || \
test "$lirc_driver" = "irman_sw"; then
lirc_driver=
-elif test "$lirc_driver" = "any"; then
+elif test "$lirc_driver" = "all"; then
lirc_driver="lirc_dev \
lirc_atiusb \
lirc_bt829 \
@@ -1316,7 +1318,7 @@
])
echo
-if test "$driver" = "any"; then
+if test "$driver" = "all"; then
echo "All kernel modules will be built."
elif test "$driver" = "mediafocusI"; then
echo "You will have to use the MediaFocus driver from:"
--- lirc-0.8.0pre1/drivers/lirc_bt829/lirc_bt829.c.orig 2005-02-19 17:12:58.000000000 +0200
+++ lirc-0.8.0pre1/drivers/lirc_bt829/lirc_bt829.c 2005-11-29 00:21:39.000000000 +0200
@@ -65,7 +65,8 @@
}while(0)
static int atir_minor;
-static unsigned long pci_addr_phys, pci_addr_lin;
+static unsigned long pci_addr_phys;
+static unsigned char *pci_addr_lin;
static struct lirc_plugin atir_plugin;
@@ -81,7 +82,7 @@
my_dev = (struct pci_dev *)pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_264VT,NULL);
if ( my_dev ) {
printk(KERN_ERR "ATIR: Using device: %s\n",
- pci_pretty_name(my_dev));
+ pci_name(my_dev));
pci_addr_phys = 0;
if ( my_dev->resource[0].flags & IORESOURCE_MEM ) {
pci_addr_phys = my_dev->resource[0].start;
@@ -161,7 +162,7 @@
static int atir_init_start(void)
{
- pci_addr_lin = (unsigned long)ioremap(pci_addr_phys + DATA_PCI_OFF,0x400);
+ pci_addr_lin = ioremap(pci_addr_phys + DATA_PCI_OFF,0x400);
if ( pci_addr_lin == 0 ) {
printk(KERN_INFO "atir: pci mem must be mapped\n");
return 0;
@@ -363,7 +364,8 @@
static unsigned int read_index(unsigned char index)
{
- unsigned int addr, value;
+ unsigned char *addr;
+ unsigned int value;
// addr = pci_addr_lin + DATA_PCI_OFF + ((index & 0xFF) << 2);
addr = pci_addr_lin + ((index & 0xFF) << 2);
value = readl(addr);
@@ -372,7 +374,7 @@
static void write_index(unsigned char index,unsigned int reg_val)
{
- unsigned int addr;
+ unsigned char *addr;
addr = pci_addr_lin + ((index & 0xFF) << 2);
writel(reg_val,addr);
}
--- lirc-0.8.0pre1/drivers/kcompat.h.orig 2005-10-29 17:18:53.000000000 +0300
+++ lirc-0.8.0pre1/drivers/kcompat.h 2005-11-29 00:21:39.000000000 +0200
@@ -187,9 +187,12 @@
#define local_irq_restore(flags) do{ restore_flags(flags); } while(0)
#endif
-#if !defined(pci_pretty_name)
-#define pci_pretty_name(dev) ((dev)->name)
-#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22)
+static inline char *pci_name(struct pci_dev *pdev)
+{
+ return pdev->slot_name;
+}
+#endif//Kernel<2.4.22
/*************************** I2C specific *****************************/
#include <linux/i2c.h>
--- lirc-0.8.0pre1/tools/lirc_client.h.orig 2005-11-01 21:12:16.000000000 +0200
+++ lirc-0.8.0pre1/tools/lirc_client.h 2005-11-29 00:21:39.000000000 +0200
@@ -14,6 +14,8 @@
#ifndef LIRC_CLIENT_H
#define LIRC_CLIENT_H
+#include <stddef.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -91,6 +93,7 @@
int lirc_code2charprog(struct lirc_config *config,char *code,char **string,
char **prog);
size_t lirc_getsocketname(const char *filename, char *buf, size_t size);
+const char *lirc_getmode(struct lirc_config *config);
/* new interface for transmit */
int lirc_send_command(int sockfd, const char *command, char *buf, size_t *buf_len, int *ret_status);
--- lirc-0.8.0pre1/tools/lirc_client.c.orig 2005-11-01 21:12:16.000000000 +0200
+++ lirc-0.8.0pre1/tools/lirc_client.c 2005-11-29 00:21:39.000000000 +0200
@@ -1723,7 +1723,7 @@
char *new_buffer;
packet_size+=PACKET_SIZE;
- new_buffer=(char *) realloc(lirc_buffer,packet_size);
+ new_buffer=(char *) realloc(lirc_buffer,packet_size+1);
if(new_buffer==NULL)
{
return(-1);
@@ -1767,6 +1767,33 @@
return strlen(filename)+2;
}
+const char *lirc_getmode(struct lirc_config *config)
+{
+ if(config->sockfd!=-1)
+ {
+ static char buf[LIRC_PACKET_SIZE];
+ size_t buf_len = LIRC_PACKET_SIZE;
+ int success;
+ int ret;
+
+ ret = lirc_send_command(config->sockfd, "GETMODE\n",
+ buf, &buf_len, &success);
+ if(success == LIRC_RET_SUCCESS)
+ {
+ if(ret > 0)
+ {
+ return buf;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+ return NULL;
+ }
+ return config->current_mode;
+}
+
static const char *lirc_read_string(int fd)
{
static char buffer[LIRC_PACKET_SIZE+1]="";
--- lirc-0.8.0pre1/tools/lirc_clientd.c.orig 2005-11-01 21:12:16.000000000 +0200
+++ lirc-0.8.0pre1/tools/lirc_clientd.c 2005-11-29 00:21:39.000000000 +0200
@@ -67,6 +67,7 @@
static int code_func(int fd,char *message,char *arguments);
static int ident_func(int fd,char *message,char *arguments);
+static int getmode_func(int fd,char *message,char *arguments);
static int send_result(int fd, char *message, const char *result);
static int send_success(int fd,char *message);
@@ -74,6 +75,7 @@
{
{"CODE",code_func},
{"IDENT",ident_func},
+ {"GETMODE",getmode_func},
{NULL,NULL}
/*
{"DEBUG",debug},
@@ -114,7 +116,10 @@
do {} while(0)
#endif
-const char *progname="lirc_clientd " VERSION;
+#define logprintf syslog
+#define logperror(prio,s) if((s)!=NULL) syslog(prio,"%s: %m\n",(char *) s); else syslog(prio,"%m\n")
+
+const char *progname="lirc_clientd";
static sig_atomic_t term=0;
static int termsig;
@@ -122,53 +127,12 @@
static struct client_data clis[MAX_CLIENTS];
static int daemonized=0;
-static FILE *lf=NULL;
-static const char *hostname="";
static struct lirc_config *config;
static int send_error(int fd,char *message,char *format_str, ...);
static int handle_input();
-void logprintf(int prio,char *format_str, ...)
-{
- time_t current;
- char *currents;
- va_list ap;
-
- current=time(&current);
- currents=ctime(&current);
-
- if(lf) fprintf(lf,"%15.15s %s %s: ",currents+4,hostname,progname);
- if(!daemonized) fprintf(stderr,"%s: ",progname);
- va_start(ap,format_str);
- if(lf)
- {
- if(prio==LOG_WARNING) fprintf(lf,"WARNING: ");
- vfprintf(lf,format_str,ap);
- fputc('\n',lf);fflush(lf);
- }
- if(!daemonized)
- {
- if(prio==LOG_WARNING) fprintf(stderr,"WARNING: ");
- vfprintf(stderr,format_str,ap);
- fputc('\n',stderr);fflush(stderr);
- }
- va_end(ap);
-}
-
-void logperror(int prio,const char *s)
-{
- if(s!=NULL)
- {
- logprintf(prio,"%s: %s",s,strerror(errno));
- }
- else
- {
- logprintf(prio,"%s",strerror(errno));
- }
-}
-
static inline int max(int a,int b)
{
return(a>b ? a:b);
@@ -554,6 +518,16 @@
return(send_success(fd,message));
}
+static int getmode_func(int fd,char *message,char *arguments)
+{
+ LOGPRINTF(2, "GETMODE %s", arguments);
+ if(lirc_getmode(config))
+ {
+ return send_result(fd, message, lirc_getmode(config));
+ }
+ return(send_success(fd,message));
+}
+
static int send_result(int fd, char *message, const char *result)
{
char *count = "1\n";
@@ -938,7 +912,7 @@
printf("\t -o --output=socket\t\toutput socket filename\n");
return(EXIT_SUCCESS);
case 'v':
- printf("%s\n",progname);
+ printf("%s %s\n",progname,VERSION);
return(EXIT_SUCCESS);
case 'p':
if(oatoi(optarg)==-1)
@@ -988,7 +962,6 @@
return EXIT_FAILURE;
}
- LOGPRINTF(3, "fork");
/* fork */
if(daemon(0,0)==-1)
{
@@ -1001,8 +974,7 @@
}
daemonized=1;
- lf = fopen("/tmp/lirc_clientd.log", "a");
-
+ openlog(progname, LOG_CONS|LOG_PID, LOG_USER);
umask(0);
signal(SIGPIPE,SIG_IGN);
@@ -1013,8 +985,10 @@
sigaction(SIGINT,&act,NULL);
sigaction(SIGHUP,&act,NULL);
+ logprintf(LOG_NOTICE, "%s started", progname);
loop(socket, lircdfd);
+ closelog();
shutdown(socket, 2);
close(socket);
lirc_freeconfig(config);
--- lirc-0.8.0pre1/configure.orig 2005-11-05 18:55:58.000000000 +0200
+++ lirc-0.8.0pre1/configure 2005-11-29 00:24:39.000000000 +0200
@@ -7995,6 +7995,7 @@
echo "$ac_t""" 1>&6
possible_drivers="(none) \
+ (userspace) \
(bte) \
(bw6130) \
(creative) \
@@ -8022,7 +8023,7 @@
if test x${no_kernel} != xyes; then
possible_drivers="${possible_drivers} \
- (any) \
+ (all) \
(lirc_dev) \
(lirc_dev lirc_atiusb) \
(lirc_dev lirc_bt829) \
@@ -8568,12 +8569,12 @@
HW_DEFAULT="hw_null"
fi
-if test "$driver" = "any"; then
+if test "$driver" = "userspace" -o "$driver" = "all"; then
cat >> confdefs.h <<\EOF
#define LIRC_DRIVER_ANY 1
EOF
- lirc_driver="any"
+ lirc_driver=$driver
any_possible_drivers=`echo ${possible_drivers} | sed -e's/ /-/g' \
-e's/)-(/ /g' -e's/(//g' -e's/)//g' \
@@ -9332,7 +9333,7 @@
{ echo "configure: error: *** you need to first install the caraca package
before you can use this driver" 1>&2; exit 1; }
;;
- any|lirc_*)
+ all|lirc_*)
{ echo "configure: error: *** you need to have the Linux kernel source installed
for this driver" 1>&2; exit 1; }
;;
@@ -9370,6 +9371,7 @@
if test "$lirc_driver" = "none" || \
test "$lirc_driver" = "alsa_usb" || \
+ test "$lirc_driver" = "userspace" || \
test "$lirc_driver" = "atilibusb" || \
test "$lirc_driver" = "audio" || \
test "$lirc_driver" = "audio_alsa" || \
@@ -9377,7 +9379,7 @@
test "$lirc_driver" = "irman" || \
test "$lirc_driver" = "irman_sw"; then
lirc_driver=
-elif test "$lirc_driver" = "any"; then
+elif test "$lirc_driver" = "all"; then
lirc_driver="lirc_dev \
lirc_atiusb \
lirc_bt829 \
@@ -10245,7 +10247,7 @@
echo
-if test "$driver" = "any"; then
+if test "$driver" = "all"; then
echo "All kernel modules will be built."
elif test "$driver" = "mediafocusI"; then
echo "You will have to use the MediaFocus driver from:"