...and it helps to make sure the patch is complete, and that everything

builds...
epel8
Jarod Wilson 16 years ago
parent 5566f87afe
commit 46618705b5

@ -10,17 +10,424 @@ diff -Naurp lirc-0.8.4a.orig/daemons/hw_devinput.c lirc-0.8.4a.upd/daemons/hw_de
hw.device);
}
#endif
diff -Naurp lirc-0.8.4a.orig/daemons/input_map.c lirc-0.8.4a.upd/daemons/input_map.c
--- lirc-0.8.4a.orig/daemons/input_map.c 1969-12-31 19:00:00.000000000 -0500
+++ lirc-0.8.4a.upd/daemons/input_map.c 2008-12-08 17:51:33.087443731 -0500
@@ -0,0 +1,58 @@
+/* $Id: input_map.c,v 5.1 2008/10/26 15:10:17 lirc Exp $ */
+
+/****************************************************************************
+ ** input_map.c *************************************************************
+ ****************************************************************************
+ *
+ * input_map.c - button namespace derived from Linux input layer
+ *
+ * Copyright (C) 2008 Christoph Bartelmus <lirc@bartelmus.de>
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "input_map.h"
+
+struct
+{
+ char *name;
+ linux_input_code code;
+
+} input_map[] = {
+#include "input_map.inc"
+ {NULL, 0}
+};
+
+int get_input_code(const char *name, linux_input_code *code)
+{
+ int i;
+
+ for(i=0; input_map[i].name != NULL; i++)
+ {
+ if(strcasecmp(name, input_map[i].name) == 0)
+ {
+ *code = input_map[i].code;
+ return i;
+ }
+ }
+ return -1;
+}
+
+void fprint_namespace(FILE *f)
+{
+ int i;
+
+ for(i=0; input_map[i].name != NULL; i++)
+ {
+ fprintf(stdout, "%s\n", input_map[i].name);
+ }
+}
+
+int is_in_namespace(const char *name)
+{
+ linux_input_code dummy;
+
+ return get_input_code(name, &dummy) == -1 ? 0 : 1;
+}
diff -Naurp lirc-0.8.4a.orig/daemons/input_map.h lirc-0.8.4a.upd/daemons/input_map.h
--- lirc-0.8.4a.orig/daemons/input_map.h 1969-12-31 19:00:00.000000000 -0500
+++ lirc-0.8.4a.upd/daemons/input_map.h 2008-12-08 17:51:33.106519735 -0500
@@ -0,0 +1,35 @@
+/* $Id: input_map.h,v 5.1 2008/10/26 15:10:17 lirc Exp $ */
+
+/****************************************************************************
+ ** input_map.h *************************************************************
+ ****************************************************************************
+ *
+ * input_map.h - button namespace derived from Linux input layer
+ *
+ * Copyright (C) 2008 Christoph Bartelmus <lirc@bartelmus.de>
+ *
+ */
+
+#ifndef INPUT_MAP_H
+#define INPUT_MAP_H
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#if defined __linux__
+#include <linux/input.h>
+#include <linux/uinput.h>
+#endif
+
+#if defined __linux__
+typedef __u16 linux_input_code;
+#else
+typedef unsigned short linux_input_code;
+#endif
+
+int get_input_code(const char *name, linux_input_code *code);
+void fprint_namespace(FILE *f);
+int is_in_namespace(const char *name);
+
+#endif /* INPUT_MAP_H */
diff -Naurp lirc-0.8.4a.orig/daemons/input_map.sh lirc-0.8.4a.upd/daemons/input_map.sh
--- lirc-0.8.4a.orig/daemons/input_map.sh 1969-12-31 19:00:00.000000000 -0500
+++ lirc-0.8.4a.upd/daemons/input_map.sh 2008-12-08 17:51:33.106519735 -0500
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+TYPES="KEY BTN"
+file=${1:-/usr/include/linux/input.h}
+
+for type in $TYPES; do
+ grep "^#define ${type}_" < $file|sort|while read; do
+ sed --expression="s/^#define \([^ ]*\)\(.*\)/{\"\1\", \2},/"|grep -v "KEY_HANGUEL\|KEY_MIN_INTERESTING"
+ done
+done
+
diff -Naurp lirc-0.8.4a.orig/daemons/irrecord.c lirc-0.8.4a.upd/daemons/irrecord.c
--- lirc-0.8.4a.orig/daemons/irrecord.c 2008-12-08 16:47:25.358745194 -0500
+++ lirc-0.8.4a.upd/daemons/irrecord.c 2008-12-08 16:55:26.208557409 -0500
@@ -1395,6 +1395,7 @@ void analyse_remote(struct ir_remote *ra
+++ lirc-0.8.4a.upd/daemons/irrecord.c 2008-12-08 18:10:06.096432179 -0500
@@ -52,6 +52,7 @@
#include "ir_remote.h"
#include "config_file.h"
#include "receive.h"
+#include "input_map.h"
void flushhw(void);
int resethw(void);
@@ -80,7 +81,7 @@ void get_scheme(struct ir_remote *remote
struct lengths *get_max_length(struct lengths *first,unsigned int *sump);
void unlink_length(struct lengths **first,struct lengths *remove);
int get_trail_length(struct ir_remote *remote, int interactive);
-int get_lead_length(struct ir_remote *remote);
+int get_lead_length(struct ir_remote *remote, int interactive);
int get_repeat_length(struct ir_remote *remote, int interactive);
int get_header_length(struct ir_remote *remote, int interactive);
int get_data_length(struct ir_remote *remote, int interactive);
@@ -96,7 +97,7 @@ const char *usage="Usage: %s [options] f
struct ir_remote remote;
struct ir_ncode ncode;
-#define IRRECORD_VERSION "0.5"
+#define IRRECORD_VERSION "5.84"
#define BUTTON 80+1
#define RETRIES 10
@@ -120,7 +121,7 @@ lirc_t aeps = 100;
#define TH_REPEAT 90
#define TH_TRAIL 90
#define TH_LEAD 90
-#define TH_IS_BIT 15
+#define TH_IS_BIT 10
#define TH_RC6_SIGNAL 550
#define MIN_GAP 20000
@@ -314,6 +315,7 @@ int main(int argc,char **argv)
int repeat_flag;
lirc_t min_remaining_gap, max_remaining_gap;
int force;
+ int disable_namespace = 0;
int retries;
int no_data = 0;
struct ir_remote *remotes=NULL;
@@ -338,6 +340,8 @@ int main(int argc,char **argv)
{"device",required_argument,NULL,'d'},
{"driver",required_argument,NULL,'H'},
{"force",no_argument,NULL,'f'},
+ {"disable-namespace",no_argument,NULL,'n'},
+ {"list-namespace",no_argument,NULL,'l'},
#ifdef DEBUG
{"pre",no_argument,NULL,'p'},
{"post",no_argument,NULL,'P'},
@@ -348,9 +352,9 @@ int main(int argc,char **argv)
{0, 0, 0, 0}
};
#ifdef DEBUG
- c = getopt_long(argc,argv,"hvad:H:fpPtiT",long_options,NULL);
+ c = getopt_long(argc,argv,"hvad:H:fnlpPtiT",long_options,NULL);
#else
- c = getopt_long(argc,argv,"hvad:H:f",long_options,NULL);
+ c = getopt_long(argc,argv,"hvad:H:fnl",long_options,NULL);
#endif
if(c==-1)
break;
@@ -362,6 +366,8 @@ int main(int argc,char **argv)
printf("\t -v --version\t\tdisplay version\n");
printf("\t -a --analyse\t\tanalyse raw_codes config files\n");
printf("\t -f --force\t\tforce raw mode\n");
+ printf("\t -n --disable-namespace\t\tdisables namespace checks\n");
+ printf("\t -l --list-namespace\t\tlist valid button names\n");
printf("\t -H --driver=driver\tuse given driver\n");
printf("\t -d --device=device\tread from given device\n");
exit(EXIT_SUCCESS);
@@ -385,6 +391,13 @@ int main(int argc,char **argv)
case 'f':
force=1;
break;
+ case 'n':
+ disable_namespace = 1;
+ break;
+ case 'l':
+ fprint_namespace(stdout);
+ exit(EXIT_SUCCESS);
+ break;
#ifdef DEBUG
case 'p':
get_pre=1;
@@ -502,7 +515,7 @@ int main(int argc,char **argv)
exit(EXIT_FAILURE);
}
strcpy(filename_new, filename);
- strcat(filename_new, ".new");
+ strcat(filename_new, ".conf");
filename = filename_new;
}
else
@@ -717,6 +730,17 @@ int main(int argc,char **argv)
{
break;
}
+ if(!disable_namespace && !is_in_namespace(buffer))
+ {
+ printf("'%s' is not in name space (use "
+ "--disable-namespace to disable checks)\n",
+ buffer);
+ printf("Use '%s --list-namespace' to see a full list "
+ "of valid button names\n",
+ progname);
+ printf("Please try again.\n");
+ continue;
+ }
if(is_raw(&remote))
{
@@ -1379,7 +1403,8 @@ void analyse_remote(struct ir_remote *ra
ir_code pre, code, post;
int repeat_flag;
lirc_t min_remaining_gap, max_remaining_gap;
- struct ir_ncode new_codes[100];
+ struct ir_ncode *new_codes;
+ size_t new_codes_count = 100;
int new_index = 0;
int ret;
@@ -1395,18 +1420,27 @@ void analyse_remote(struct ir_remote *ra
next_code = NULL;
current_code = NULL;
current_index = 0;
+ memset(&remote, 0, sizeof(remote));
get_lengths(&remote, 0, 0 /* not interactive */ );
if(is_rc6(&remote))
- if(is_rc6(&remote))
+ if(is_rc6(&remote) && remote.bits >= 5)
{
/* have to assume something as it's very difficult to
extract the rc6_mask from the data that we have */
- remote.rc6_mask = (ir_code) 0x100000000ll;
+ remote.rc6_mask = ((ir_code) 0x1ll) << (remote.bits-5);
}
remote.name = raw_data->name;
+ remote.freq = raw_data->freq;
- memset(new_codes, 0, sizeof(new_codes));
+ new_codes = malloc(new_codes_count * sizeof(*new_codes));
+ if(new_codes == NULL)
+ {
+ fprintf(stderr, "%s: out of memory\n",
+ progname);
+ return;
+ }
+ memset(new_codes, 0 , new_codes_count * sizeof(*new_codes));
codes = raw_data->codes;
while(codes->name!=NULL)
{
@@ -1429,6 +1463,25 @@ void analyse_remote(struct ir_remote *ra
}
else
{
+ if(new_index+1 >= new_codes_count)
+ {
+ struct ir_ncode *renew_codes;
+
+ new_codes_count *= 2;
+ renew_codes = realloc
+ (new_codes,
+ new_codes_count * sizeof(*new_codes));
+ if(renew_codes == NULL)
+ {
+ fprintf(stderr, "%s: out of memory\n",
+ progname);
+ free(new_codes);
+ return;
+ }
+ memset(&new_codes[new_codes_count/2], 0 , new_codes_count/2 * sizeof(*new_codes));
+ new_codes = renew_codes;
+ }
+
new_codes[new_index].name = codes->name;
new_codes[new_index].code = code;
new_index++;
@@ -1438,6 +1491,8 @@ void analyse_remote(struct ir_remote *ra
new_codes[new_index].name = NULL;
remote.codes = new_codes;
fprint_remotes(stdout, &remote);
+ remote.codes = NULL;
+ free(new_codes);
}
#ifdef DEBUG
@@ -1610,7 +1665,7 @@ inline lirc_t calc_signal(struct lengths
int get_lengths(struct ir_remote *remote, int force, int interactive)
{
int retval;
- lirc_t data,average,sum,remaining_gap,header;
+ lirc_t data,average,maxspace,sum,remaining_gap,header;
enum analyse_mode mode=MODE_GAP;
int first_signal;
@@ -1628,7 +1683,7 @@ int get_lengths(struct ir_remote *remote
flushhw();
}
retval=1;
- average=0;sum=0;count=0;count_spaces=0;
+ average=0;maxspace=0;sum=0;count=0;count_spaces=0;
count_3repeats=0;count_5repeats=0;count_signals=0;
first_signal=-1;header=0;
first_length=0;
@@ -1657,12 +1712,15 @@ int get_lengths(struct ir_remote *remote
continue;
}
average=data;
+ maxspace=data;
}
else if(is_space(data))
{
if(data>MIN_GAP || data>100*average ||
/* this MUST be a gap */
- (count_spaces>10 && data>5*average))
+ (count_spaces>10 && data>5*average)
+ /* || Echostar
+ (count_spaces>20 && data>9*maxspace/10)*/)
/* this should be a gap */
{
struct lengths *scan;
@@ -1674,7 +1732,7 @@ int get_lengths(struct ir_remote *remote
merge_lengths(first_sum);
add_length(&first_gap,data);
merge_lengths(first_gap);
- sum=0;count_spaces=0;average=0;
+ sum=0;count_spaces=0;average=0;maxspace=0;
maxcount=0;
scan=first_sum;
@@ -1740,6 +1798,10 @@ int get_lengths(struct ir_remote *remote
average=(average*count_spaces+data)
/(count_spaces+1);
count_spaces++;
+ if(data>maxspace)
+ {
+ maxspace=data;
+ }
}
if(count>SAMPLES*MAX_SIGNALS*2)
{
@@ -1773,8 +1835,9 @@ int get_lengths(struct ir_remote *remote
}
sum+=data&PULSE_MASK;
- if((data&PULSE_MASK)>=remaining_gap*(100-eps)/100
- || (data&PULSE_MASK)>=remaining_gap-aeps)
+ if(count>2 &&
+ ((data&PULSE_MASK)>=remaining_gap*(100-eps)/100
+ || (data&PULSE_MASK)>=remaining_gap-aeps))
{
if(is_space(data))
{
@@ -1882,7 +1945,7 @@ int get_lengths(struct ir_remote *remote
get_scheme(remote, interactive);
if(!get_header_length(remote, interactive) ||
!get_trail_length(remote, interactive) ||
- !get_lead_length(remote) ||
+ !get_lead_length(remote, interactive) ||
!get_repeat_length(remote, interactive) ||
!get_data_length(remote, interactive))
{
@@ -2173,7 +2236,7 @@ int get_trail_length(struct ir_remote *r
return(1);
}
-int get_lead_length(struct ir_remote *remote)
+int get_lead_length(struct ir_remote *remote, int interactive)
{
unsigned int sum,max_count;
struct lengths *first_lead,*max_length,*max2_length;
@@ -2190,7 +2253,7 @@ int get_lead_length(struct ir_remote *re
# endif
if(max_count>=sum*TH_LEAD/100)
{
- printf("Found lead pulse: %lu\n",
+ iprintf(interactive, "Found lead pulse: %lu\n",
(unsigned long) calc_signal(max_length));
remote->plead=calc_signal(max_length);
return(1);
@@ -2207,12 +2270,12 @@ int get_lead_length(struct ir_remote *re
}
if(abs(2*a-b)<b*eps/100 || abs(2*a-b)<aeps)
{
- printf("Found hidden lead pulse: %lu\n",
+ iprintf(interactive, "Found hidden lead pulse: %lu\n",
(unsigned long) a);
remote->plead=a;
return(1);
}
- printf("No lead pulse found.\n");
+ iprintf(interactive, "No lead pulse found.\n");
return(1);
}
diff -Naurp lirc-0.8.4a.orig/daemons/lircd.c lirc-0.8.4a.upd/daemons/lircd.c
--- lirc-0.8.4a.orig/daemons/lircd.c 2008-10-04 17:48:43.000000000 -0400
+++ lirc-0.8.4a.upd/daemons/lircd.c 2008-12-08 17:06:32.108557638 -0500
@ -515,8 +922,17 @@ diff -Naurp lirc-0.8.4a.orig/daemons/lircd.h lirc-0.8.4a.upd/daemons/lircd.h
void loop(void);
diff -Naurp lirc-0.8.4a.orig/daemons/Makefile.am lirc-0.8.4a.upd/daemons/Makefile.am
--- lirc-0.8.4a.orig/daemons/Makefile.am 2008-09-21 14:33:19.000000000 -0400
+++ lirc-0.8.4a.upd/daemons/Makefile.am 2008-12-08 16:50:31.050433540 -0500
@@ -59,7 +59,8 @@ libhw_module_a_DEPENDENCIES = @hw_module
+++ lirc-0.8.4a.upd/daemons/Makefile.am 2008-12-08 17:58:11.557500930 -0500
@@ -7,6 +7,8 @@
INCLUDES = -I$(top_srcdir)
+BUILT_SOURCES = input_map.inc
+
noinst_LIBRARIES = libhw_module.a
libhw_module_a_SOURCES = \
hw-types.c hw-types.h hardware.h \
@@ -59,7 +61,8 @@ libhw_module_a_DEPENDENCIES = @hw_module
sbin_PROGRAMS = lircd lircmd
lircd_SOURCES = lircd.c lircd.h \
@ -526,7 +942,17 @@ diff -Naurp lirc-0.8.4a.orig/daemons/Makefile.am lirc-0.8.4a.upd/daemons/Makefil
lircd_LDADD = @daemon@ libhw_module.a @hw_module_libs@
lircmd_SOURCES = lircmd.c
@@ -79,6 +80,7 @@ EXTRA_PROGRAMS = lircd.simsend lircd.sim
@@ -69,7 +72,8 @@ bin_PROGRAMS = irrecord
irrecord_SOURCES = irrecord.c \
config_file.c config_file.h \
- dump_config.c dump_config.h
+ dump_config.c dump_config.h \
+ input_map.c input_map.h
irrecord_LDADD = libhw_module.a @hw_module_libs@ @receive@
irrecord_DEPENDENCIES = @receive@
@@ -79,6 +83,7 @@ EXTRA_PROGRAMS = lircd.simsend lircd.sim
noinst_PROGRAMS = @maintmode_daemons_extra@
lircd_simsend_SOURCES = lircd.c ir_remote.c config_file.c \
lircd.h ir_remote.h ir_remote_types.h config_file.h \
@ -534,7 +960,7 @@ diff -Naurp lirc-0.8.4a.orig/daemons/Makefile.am lirc-0.8.4a.upd/daemons/Makefil
hw-types.c hw-types.h hardware.h \
hw_default.c hw_default.h \
receive.c receive.h \
@@ -87,6 +89,7 @@ lircd_simsend_SOURCES = lircd.c ir_remot
@@ -87,6 +92,7 @@ lircd_simsend_SOURCES = lircd.c ir_remot
lircd_simsend_CFLAGS = -DSIM_SEND
lircd_simrec_SOURCES = lircd.c ir_remote.c config_file.c \
lircd.h ir_remote.h ir_remote_types.h config_file.h \
@ -542,6 +968,17 @@ diff -Naurp lirc-0.8.4a.orig/daemons/Makefile.am lirc-0.8.4a.upd/daemons/Makefil
hw-types.c hw-types.h hardware.h \
hw_default.c hw_default.h \
receive.c receive.h \
@@ -125,4 +131,10 @@ rmfifo:
-$(RM) $(DESTDIR)$(devdir)/lircd
-$(RM) $(DESTDIR)$(devdir)/lircm
+input_map.inc:
+ $(srcdir)/input_map.sh >$@
+
+DISTCLEANFILES = input_map.inc
+EXTRA_DIST = input_map.inc input_map.sh
+
CLEANFILES = *~
diff -Naurp lirc-0.8.4a.orig/daemons/release.c lirc-0.8.4a.upd/daemons/release.c
--- lirc-0.8.4a.orig/daemons/release.c 2008-02-06 08:43:07.000000000 -0500
+++ lirc-0.8.4a.upd/daemons/release.c 2008-12-08 16:59:03.799472804 -0500
@ -680,7 +1117,7 @@ diff -Naurp lirc-0.8.4a.orig/daemons/release.c lirc-0.8.4a.upd/daemons/release.c
return NULL;
diff -Naurp lirc-0.8.4a.orig/daemons/release.h lirc-0.8.4a.upd/daemons/release.h
--- lirc-0.8.4a.orig/daemons/release.h 2007-05-06 07:54:02.000000000 -0400
+++ lirc-0.8.4a.upd/daemons/release.h 2008-12-08 16:58:00.938502877 -0500
+++ lirc-0.8.4a.upd/daemons/release.h 2008-12-08 17:48:55.251581644 -0500
@@ -1,4 +1,4 @@
-/* $Id: release.h,v 1.1 2007/05/06 11:54:02 lirc Exp $ */
+/* $Id: release.h,v 1.2 2008/12/06 20:00:03 lirc Exp $ */
@ -703,7 +1140,7 @@ diff -Naurp lirc-0.8.4a.orig/daemons/release.h lirc-0.8.4a.upd/daemons/release.h
+ const char **button_name);
+const char *trigger_release_event(const char **remote_name,
+ const char **button_name);
+const char *release_map_remotes(struct ir_remote *old, struct ir_remote *new
+const char *release_map_remotes(struct ir_remote *old, struct ir_remote *new,
+ const char **remote_name,
+ const char **button_name);

@ -118,7 +118,7 @@ of remote control configuration files.
%prep
%setup -q -n %{name}-%{version}%{?pre}
%patch0 -p1 -b .suf
%patch0 -p1
chmod 644 contrib/*
@ -156,6 +156,10 @@ touch -r aclocal.m4 configure.ac # avoid autofoo re-run
%patch2 -p1
%patch3 -p1
%patch4 -p1
# Re-run autofoo for new cvs features
autoreconf -i -f
automake
chmod +x daemons/input_map.sh
%build
%configure \

Loading…
Cancel
Save