On Nov 10, 2007 10:03 PM, Richard Storm <[EMAIL PROTECTED]> wrote: > Hello! > I have macbook: > hw.model=Intel(R) Core(TM)2 CPU T7400 @ 2.16GHz > hw.vendor=Apple Inc. > hw.product=MacBook2,1 > hw.version=1.0 > > On http://wiki.freebsd.org/AppleMacbook "IR receiver" section there is > tool available at http://fnop.net/~rpaulo/priv/freebsd/aird.tgz. > > Here is patch that makes it compile/work under openbsd with my macbook > and remote control. > > Ignore manpage, run like this: > ./aird -vd -f /dev/uhid1 -M "echo menu" -P "echo play" -F "echo > forward" -B "echo backward" -U "echo volumeup" -D "echo volumedown" > > > --- aird.c.orig Tue Jul 31 21:26:36 2007 > +++ aird.c Sat Nov 10 22:56:10 2007 > @@ -50,7 +50,6 @@ > */ > > #include <sys/cdefs.h> > -__FBSDID("$FreeBSD$"); > > #include <err.h> > #include <errno.h> > @@ -69,24 +68,17 @@ > #include <sys/ioctl.h> > #include <sys/stat.h> > > -#include <libutil.h> > #include <dev/usb/usb.h> > #include <dev/usb/usbhid.h> > > -static struct pidfh *pfh; > - > static void sighandler(int sig); > static void usage(void); > static void runcmd(const char *cmd, int fd); > > > -static void > -sighandler(__unused int sig) > +static void sighandler(int sig) > { > > - if (pfh) > - pidfile_remove(pfh); > - > exit(EXIT_SUCCESS); > } > > @@ -96,7 +88,7 @@ > fprintf(stderr, "usage: %s [-vd] [-p pidfile] -f device " > "[-M menu command]\n\t[-P play command] [-F forward command] " > "[-B backward command]\n\t[-U volume up command] " > - "[-D volume down command]\n", getprogname()); > + "[-D volume down command]\n", "aird"); > > exit(1); > } > @@ -132,8 +124,6 @@ > const char *deventry; > unsigned char key; > > - pfh = NULL; > - > signal(SIGHUP, sighandler); > signal(SIGINT, sighandler); > signal(SIGCHLD, SIG_IGN); > @@ -207,23 +197,9 @@ > err(EXIT_FAILURE, "open %s", deventry); > > if (!foreground) { > - pfh = pidfile_open(pidfile, 0600, &otherpid); > - if (pfh == NULL) { > - if (errno == EEXIST) { > - errx(EXIT_FAILURE, > - "Daemon already running, pid: %jd.", > - (intmax_t)otherpid); > - } > - /* If we cannot create pidfile from other reasons, > - only warn. */ > - warn("Cannot open or create pidfile"); > - } > - > if (daemon(0, 0) < 0) { > - pidfile_remove(pfh); > err(EXIT_FAILURE, "daemon"); > } > - pidfile_write(pfh); > } > > memset(prevbuf, 0, sizeof(prevbuf)); > @@ -243,9 +219,6 @@ > exit(EXIT_SUCCESS); > } > > - if (key && buf[3] != key) > - continue; > - > /* > * Check for key repeats. > */ > @@ -273,7 +246,7 @@ > repeating = 0; > } > > - switch (buf[4]) { > + switch (buf[3]) { > /* Menu */ > case 0x02: > case 0x03: > @@ -308,7 +281,6 @@ > } > > } > - pidfile_remove(pfh); > close(fd); > > return (0); >
Cool! I'm slacking behind on my coding so I really need to update my source and see if my bluetooth patches works. I'll see if I get time to test this when I get home. BR dunceor