From fe2da98147fd72ecf8b19984e15e508c2a741d85 Mon Sep 17 00:00:00 2001 From: Jarod Wilson Date: Mon, 15 Feb 2010 17:09:34 +0000 Subject: [PATCH] Helps to patch the files using the patched header too --- lirc-0.8.6-remove-obsolete-modes.patch | 405 ++++++++++++++++++++++++- 1 file changed, 403 insertions(+), 2 deletions(-) diff --git a/lirc-0.8.6-remove-obsolete-modes.patch b/lirc-0.8.6-remove-obsolete-modes.patch index ca25341..906db17 100644 --- a/lirc-0.8.6-remove-obsolete-modes.patch +++ b/lirc-0.8.6-remove-obsolete-modes.patch @@ -2,7 +2,15 @@ Index: lirc-0.8.6/drivers/lirc.h =================================================================== --- lirc-0.8.6.orig/drivers/lirc.h +++ lirc-0.8.6/drivers/lirc.h -@@ -27,17 +27,13 @@ typedef int lirc_t; +@@ -11,6 +11,7 @@ + #define __USE_LINUX_IOCTL_DEFS + #include + #endif ++#include + + #define PULSE_BIT 0x01000000 + #define PULSE_MASK 0x00FFFFFF +@@ -27,17 +28,13 @@ typedef int lirc_t; #define LIRC_MODE_RAW 0x00000001 #define LIRC_MODE_PULSE 0x00000002 #define LIRC_MODE_MODE2 0x00000004 @@ -20,7 +28,7 @@ Index: lirc-0.8.6/drivers/lirc.h #define LIRC_CAN_SEND_MASK 0x0000003f -@@ -48,9 +44,7 @@ typedef int lirc_t; +@@ -48,9 +45,7 @@ typedef int lirc_t; #define LIRC_CAN_REC_RAW LIRC_MODE2REC(LIRC_MODE_RAW) #define LIRC_CAN_REC_PULSE LIRC_MODE2REC(LIRC_MODE_PULSE) #define LIRC_CAN_REC_MODE2 LIRC_MODE2REC(LIRC_MODE_MODE2) @@ -30,3 +38,396 @@ Index: lirc-0.8.6/drivers/lirc.h #define LIRC_CAN_REC_MASK LIRC_MODE2REC(LIRC_CAN_SEND_MASK) +Index: lirc-0.8.6/daemons/hw_alsa_usb.c +=================================================================== +--- lirc-0.8.6.orig/daemons/hw_alsa_usb.c ++++ lirc-0.8.6/daemons/hw_alsa_usb.c +@@ -37,9 +37,9 @@ static int repeat_flag; + struct hardware hw_alsa_usb = { + "", /* default device */ + -1, /* fd */ +- LIRC_CAN_REC_CODE, /* features */ ++ LIRC_CAN_REC_LIRCCODE, /* features */ + 0, /* send_mode */ +- LIRC_MODE_CODE, /* rec_mode */ ++ LIRC_MODE_LIRCCODE, /* rec_mode */ + 8, /* code_length */ + init, /* init_func */ + NULL, /* config_func */ +Index: lirc-0.8.6/daemons/hw_awlibusb.c +=================================================================== +--- lirc-0.8.6.orig/daemons/hw_awlibusb.c ++++ lirc-0.8.6/daemons/hw_awlibusb.c +@@ -48,8 +48,6 @@ + #include "lircd.h" + #include "receive.h" + +-#define AW_MODE_LIRCCODE 1 +- + #define AWUSB_RECEIVE_BYTES 5 + #define USB_TIMEOUT (1000*60) + #define AW_VENDOR_THOMSON 0x069b +@@ -57,14 +55,6 @@ + + #define AW_KEY_GAP 0 /* Original value=200000. Made it 0 to handle it in userspace */ + +-#if !defined(AW_MODE_LIRCCODE) +-static ir_code code; +-static ir_code code_last; +-static struct timeval time_current = {0}; +-static struct timeval time_last = {0}; +-#endif +- +- + static int awlibusb_init(); + static int awlibusb_deinit(); + static char *awlibusb_rec(struct ir_remote *remotes); +@@ -72,7 +62,6 @@ static void usb_read_loop(int fd); + static struct usb_device *find_usb_device(void); + static int find_device_endpoints(struct usb_device *dev); + +-#ifdef AW_MODE_LIRCCODE + struct hardware hw_awlibusb = + { + NULL, /* default device */ +@@ -91,26 +80,7 @@ struct hardware hw_awlibusb = + NULL, /* readdata */ + "awlibusb" + }; +-#else +-struct hardware hw_awlibusb = +-{ +- NULL, /* default device */ +- -1, /* fd */ +- LIRC_CAN_REC_CODE, /* features */ +- 0, /* send_mode */ +- LIRC_MODE_CODE, /* rec_mode */ +- CHAR_BIT, /* code_length */ +- awlibusb_init, /* init_func */ +- NULL, /* config_func */ +- awlibusb_deinit, /* deinit_func */ +- NULL, /* send_func */ +- awlibusb_rec, /* rec_func */ +- receive_decode, /* decode_func */ +- NULL, /* ioctl_func */ +- NULL, /* readdata */ +- "awlibusb" +-}; +-#endif ++ + typedef struct { + u_int16_t vendor; + u_int16_t product; +@@ -310,11 +280,6 @@ static void usb_read_loop(int fd) + { + int inited = 0; + int err = 0; +-#if !defined(AW_MODE_LIRCCODE) +- long elapsed_seconds = 0; /* diff between seconds counter */ +- long elapsed_useconds = 0; /* diff between microseconds counter */ +- long time_diff = 0; +-#endif + + alarm(0); + signal(SIGTERM, SIG_DFL); +@@ -348,7 +313,6 @@ static void usb_read_loop(int fd) + if (bytes_r == 1) continue; + } + +-#ifdef AW_MODE_LIRCCODE + bytes_w = write(fd, &(buf[1]), (AWUSB_RECEIVE_BYTES-1)); + /* ignore first byte */ + if (bytes_w < 0) +@@ -358,30 +322,6 @@ static void usb_read_loop(int fd) + err = 1; + goto done; + } +-#else +- code = buf[AWUSB_RECEIVE_BYTES-2]; +- +- /* calculate time diff */ +- gettimeofday(&time_current, NULL); +- elapsed_seconds = time_current.tv_sec - time_last.tv_sec; +- elapsed_useconds = time_current.tv_usec - time_last.tv_usec; +- time_diff = (elapsed_seconds) * 1000000 + elapsed_useconds; +- //printf("time_diff = %d usec\n", time_diff); +- +- if ( !((code == code_last) && (time_diff < AW_KEY_GAP)) ) +- { +- bytes_w = write(fd, &code, 1); +- if (bytes_w < 0) +- { +- logprintf(LOG_ERR, "can't write to pipe: %s", +- strerror(errno)); +- err = 1; +- goto done; +- } +- code_last = code; +- memcpy(&time_last, &time_current, sizeof(struct timeval)); +- } +-#endif + + } + +Index: lirc-0.8.6/daemons/hw_default.c +=================================================================== +--- lirc-0.8.6.orig/daemons/hw_default.c ++++ lirc-0.8.6/daemons/hw_default.c +@@ -42,10 +42,7 @@ extern struct ir_remote *repeat_remote; + + static unsigned long supported_send_modes[]= + { +- /* LIRC_CAN_SEND_STRING, I don't think there ever will be a driver +- that supports that */ + /* LIRC_CAN_SEND_LIRCCODE, */ +- /* LIRC_CAN_SEND_CODE, */ + /* LIRC_CAN_SEND_MODE2, this one would be very easy */ + LIRC_CAN_SEND_PULSE, + /* LIRC_CAN_SEND_RAW, */ +@@ -53,9 +50,7 @@ static unsigned long supported_send_mode + }; + static unsigned long supported_rec_modes[]= + { +- LIRC_CAN_REC_STRING, + LIRC_CAN_REC_LIRCCODE, +- LIRC_CAN_REC_CODE, + LIRC_CAN_REC_MODE2, + /* LIRC_CAN_REC_PULSE, shouldn't be too hard */ + /* LIRC_CAN_REC_RAW, */ +@@ -365,10 +360,6 @@ int default_init() + } + + } +- else if(hw.rec_mode==LIRC_MODE_CODE) +- { +- hw.code_length=8; +- } + else if(hw.rec_mode==LIRC_MODE_LIRCCODE) + { + if(default_ioctl(LIRC_GET_LENGTH, &hw.code_length)==-1) +@@ -524,47 +515,12 @@ int default_send(struct ir_remote *remot + + char *default_rec(struct ir_remote *remotes) + { +- char c; +- int n; +- static char message[PACKET_SIZE+1]; +- +- +- if(hw.rec_mode==LIRC_MODE_STRING) +- { +- int failed=0; +- +- /* inefficient but simple, fix this if you want */ +- n=0; +- do +- { +- if(read(hw.fd,&c,1)!=1) +- { +- logprintf(LOG_ERR,"reading in mode " +- "LIRC_MODE_STRING failed"); +- default_deinit(); +- return NULL; +- } +- if(n>=PACKET_SIZE-1) +- { +- failed=1; +- n=0; +- } +- message[n++]=c; +- } +- while(c!='\n'); +- message[n]=0; +- if(failed) return(NULL); +- return(message); +- } +- else ++ if(!clear_rec_buffer()) + { +- if(!clear_rec_buffer()) +- { +- default_deinit(); +- return NULL; +- } +- return(decode_all(remotes)); ++ default_deinit(); ++ return NULL; + } ++ return(decode_all(remotes)); + } + + static int default_config_frequency() +Index: lirc-0.8.6/daemons/hw_mplay.c +=================================================================== +--- lirc-0.8.6.orig/daemons/hw_mplay.c ++++ lirc-0.8.6/daemons/hw_mplay.c +@@ -114,9 +114,9 @@ static struct { + struct hardware hw_mplay = { + LIRC_DRIVER_DEVICE, /* default device */ + -1, /* fd */ +- LIRC_CAN_REC_CODE, /* features */ ++ LIRC_CAN_REC_LIRCCODE, /* features */ + 0, /* send_mode */ +- LIRC_MODE_CODE, /* rec_mode */ ++ LIRC_MODE_LIRCCODE, /* rec_mode */ + MPLAY_CODE_LENGTH, /* code_length */ + mplay_init, /* init_func */ + NULL, /* config_func */ +Index: lirc-0.8.6/daemons/irrecord.c +=================================================================== +--- lirc-0.8.6.orig/daemons/irrecord.c ++++ lirc-0.8.6/daemons/irrecord.c +@@ -556,16 +556,7 @@ int main(int argc,char **argv) + } + aeps = (hw.resolution>aeps ? hw.resolution:aeps); + +- if(hw.rec_mode==LIRC_MODE_STRING) +- { +- fprintf(stderr,"%s: no config file necessary\n",progname); +- fclose(fout); +- unlink(filename); +- if(hw.deinit_func) hw.deinit_func(); +- exit(EXIT_SUCCESS); +- } + if(hw.rec_mode!=LIRC_MODE_MODE2 && +- hw.rec_mode!=LIRC_MODE_CODE && + hw.rec_mode!=LIRC_MODE_LIRCCODE) + { + fprintf(stderr,"%s: mode not supported\n",progname); +@@ -661,10 +652,8 @@ int main(int argc,char **argv) + (unsigned long) remote.gap); + # endif + break; +- case LIRC_MODE_CODE: + case LIRC_MODE_LIRCCODE: +- if(hw.rec_mode==LIRC_MODE_CODE) remote.bits=CHAR_BIT; +- else remote.bits=hw.code_length; ++ remote.bits=hw.code_length; + if(!using_template && !get_gap_length(&remote)) + { + fprintf(stderr,"%s: gap not found," +@@ -995,9 +984,6 @@ void flushhw(void) + case LIRC_MODE_MODE2: + while(availabledata()) hw.readdata(0); + return; +- case LIRC_MODE_CODE: +- size=sizeof(unsigned char); +- break; + case LIRC_MODE_LIRCCODE: + size=hw.code_length/CHAR_BIT; + if(hw.code_length%CHAR_BIT) size++; +Index: lirc-0.8.6/daemons/receive.c +=================================================================== +--- lirc-0.8.6.orig/daemons/receive.c ++++ lirc-0.8.6/daemons/receive.c +@@ -126,18 +126,6 @@ int clear_rec_buffer(void) + ((ir_code) buffer[i]); + } + } +- else if(hw.rec_mode==LIRC_MODE_CODE) +- { +- unsigned char c; +- +- if(read(hw.fd,&c,1)!=1) +- { +- logprintf(LOG_ERR,"reading in mode LIRC_MODE_CODE " +- "failed"); +- return(0); +- } +- rec_buffer.decoded=(ir_code) c; +- } + else + { + lirc_t data; +@@ -1191,8 +1179,7 @@ int receive_decode(struct ir_remote *rem + struct ir_ncode *codes,*found; + int i; + +- if(hw.rec_mode==LIRC_MODE_CODE || +- hw.rec_mode==LIRC_MODE_LIRCCODE) ++ if(hw.rec_mode==LIRC_MODE_LIRCCODE) + return(0); + + codes=remote->codes; +@@ -1233,8 +1220,7 @@ int receive_decode(struct ir_remote *rem + } + else + { +- if(hw.rec_mode==LIRC_MODE_CODE || +- hw.rec_mode==LIRC_MODE_LIRCCODE) ++ if(hw.rec_mode==LIRC_MODE_LIRCCODE) + { + lirc_t sum; + ir_code decoded = rec_buffer.decoded; +@@ -1244,11 +1230,7 @@ int receive_decode(struct ir_remote *rem + # else + LOGPRINTF(1,"decoded: %lx", decoded); + # endif +- if((hw.rec_mode==LIRC_MODE_CODE && +- hw.code_length