Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.2
irda
irda-parseoldasssysconfig.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File irda-parseoldasssysconfig.patch of Package irda
--- irattach/irattach.c.orig +++ irattach/irattach.c @@ -40,6 +40,13 @@ #include <sys/utsname.h> #include <irda.h> +#include <error.h> +#include <stdlib.h> +#include <libHX/defs.h> +#include <libHX/map.h> +#include <libHX/option.h> + +#define streq(a, b) (strcmp((a), (b)) == 0) #ifndef N_IRDA #define N_IRDA 11 /* This one should go in .../asm/termio.h */ @@ -660,17 +667,20 @@ int main(int argc, char *argv[]) int c; int ret; int daemonize = 1; /* Go to background by default */ + struct HXmap *sc_map; //printf("%s\n", VERSION); - if ((argc < 2) || (argc > 5)) { + if ((argc > 5)) { print_usage(); exit(-1); } /* First arg is device name. Save it now, because in some cases * getopt() will remove it... */ + if(argv[1] != NULL && strlen(argv[1]) > 0) { strncpy(device, argv[1], 20); device[20] = '\0'; + } /* Look for options */ /* Do this before processing device, to handle "-h" and -v" @@ -706,6 +716,50 @@ int main(int argc, char *argv[]) } } + sc_map = HX_shconfig_map("/etc/sysconfig/irda"); + if (sc_map != NULL) { + char *v; + v = HXmap_get(sc_map, "IRDA_DONGLE"); + if (dongle == -1 && v != NULL && strlen(v) > 0) { + dongle = get_dongle(v); + if(dongle == -1) + error(EXIT_FAILURE, ENOTSUP, "attaching dongle %s failed", v); + + syslog(LOG_INFO, "sysconfig requested use of irda dongle: %s\n", v); + } + v = HXmap_get(sc_map, "IRDA_DISCOVERY"); + if (discovery == -1 && v != NULL && strlen(v) > 0 && streq(v, "no")) { + discovery = 0; + syslog(LOG_INFO, "sysconfig disabled irda discovery\n"); + } + v = HXmap_get(sc_map, "IRDA_PORT"); + if (device == NULL && v != NULL && strlen(v) > 0) { + if(snprintf(device, sizeof(device), "%s", v) < 0) + error(EXIT_FAILURE, EINVAL, "attaching irda device %s failed", v); + syslog(LOG_INFO, "sysconfig set irda port to %s\n", v); + } + v = HXmap_get(sc_map, "IRDA_MAX_BAUD_RATE"); + if (v != NULL && strlen(v) > 0) { + long int baud_rate = strtol(v, NULL, 0); + if(baud_rate != 0) { + FILE *procfs = fopen("/proc/sys/net/irda/max_baud_rate", "we"); + if(procfs != NULL) { + if(fprintf(procfs, "%d", baud_rate) > 0) { + syslog(LOG_INFO, "sysconfig requested max_baud_rate to be set to %d\n", baud_rate); + } + fclose(procfs); + } else { + syslog(LOG_WARNING, "failed to set max_baud_rate to %d: %m\n", baud_rate); + } + } + } + } + /* still no device ? duh.. */ + if(device == NULL || strlen(device) == 0) { + print_usage(); + exit(-1); + } + /* Check if the device is a tty */ if(strncmp("/dev", device, 4) == 0) { /* We are managing a tty ! */ --- irattach/Makefile.orig +++ irattach/Makefile @@ -33,7 +33,7 @@ CFLAGS = $(RPM_OPT_FLAGS) -O2 -W - SYS_INCLUDES = -I/usr/include SYS_LIBPATH = -INCLUDES = $(SYS_INCLUDES) -I../include/ +INCLUDES = $(SYS_INCLUDES) -I../include/ $(shell pkg-config --cflags libHX) LIBRARIES = $(SYS_LIBRARIES) LIBPATH = $(SYS_LIBPATH) @@ -49,7 +49,7 @@ all: $(TARGETS) irattach: irattach.o util.o $(prn_cc_o) - $(ECMD)$(CC) $(CFLAGS) irattach.o util.o -o $@ + $(ECMD)$(CC) $(CFLAGS) irattach.o util.o -o $@ $(shell pkg-config --libs libHX)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor