cwiid-0.6.00+svn201/0000755000175000017500000000000011260043606013021 5ustar tootstootscwiid-0.6.00+svn201/doc/0000755000175000017500000000000011260043516013566 5ustar tootstootscwiid-0.6.00+svn201/doc/wminput.list0000644000175000017500000000133210570710206016165 0ustar tootstoots#Note: this is a list of button and axis IDs, and is not a valid configuration #file # Wiimote Buttons Wiimote.Up Wiimote.Down Wiimote.Left Wiimote.Right Wiimote.A Wiimote.B Wiimote.Minus Wiimote.Plus Wiimote.Home Wiimote.1 Wiimote.2 # Wiimote Axes Wiimote.Dpad.X Wiimote.Dpad.Y # Nunchuk Buttons Nunchuk.C Nunchuk.Z # Nunchuk Axes Nunchuk.Stick.X Nunchuk.Stick.Y # Classic Controller Buttons Classic.Up Classic.Down Classic.Left Classic.Right Classic.Minus Classic.Plus Classic.Home Classic.A Classic.B Classic.X Classic.Y Classic.ZL Classic.ZR Classic.L Classic.R #Classic Controller Axes Classic.Dpad.X Classic.Dpad.Y Classic.LStick.X Classic.LStick.Y Classic.RStick.X Classic.RStick.Y Classic.LAnalog Classic.RAnalog cwiid-0.6.00+svn201/doc/Xmodmap0000644000175000017500000000021510567071413015122 0ustar tootstootskeycode 130=XF86HomePage keycode 151=XF86User2KB keycode 158=XF86MenuKB keycode 159=XF86User1KB keycode 234=XF86Back keycode 233=XF86Forward cwiid-0.6.00+svn201/doc/Makefile.in0000644000175000017500000000055210634140413015633 0ustar tootstoots#Copyright (C) 2007 L. Donnie Smith include @top_builddir@/defs.mak docfiles = Xmodmap wminput.list DEST_DOC_DIR = $(ROOTDIR)$(docdir) all: install: $(DEST_DOC_DIR) install -m 644 $(docfiles) $(DEST_DOC_DIR) $(DEST_DOC_DIR): install -d $(DEST_DOC_DIR) uninstall: rm -rf $(DEST_DOC_DIR) distclean: rm Makefile .PHONY: all install uninstall distclean cwiid-0.6.00+svn201/man/0000755000175000017500000000000011260043516013574 5ustar tootstootscwiid-0.6.00+svn201/man/man1/0000755000175000017500000000000011260043407014427 5ustar tootstootscwiid-0.6.00+svn201/man/man1/wminput.10000644000175000017500000001017410664426060016226 0ustar tootstoots.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH WMINPUT 1 "janvier 18, 2007" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME wminput \- an event driver for the wiimote .SH SYNOPSIS .B wminput .RI [ options ] .br .SH DESCRIPTION This manual page documents briefly the .B wminput command. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. \fBwminput\fP is a program that provides an event driver for the wiimote, supporting all buttons (except Power) and pointer tracking, and featuring a tracking algorithm plugin architecture. .PP Your kernel must be configured with uinput support (INPUT_UINPUT, or Device Drivers/Input Device Support/Miscellaneous Drivers/User Level Driver Support under menuconfig). Compile into the kernel or as a module. See http://gentoo-wiki.com/HOWTO_Compile_a_Kernel_Manually for information on kernel compilation. By default, some (most? all?) udev configurations set up a uinput device file readable only by root. Using wminput as a user other than root requires configuration udev to change the permissions on uinput. Place the following line in a file in /etc/udev/rules.d (see the documentation for your distro for the recommended file for local rules) to allow anyone on the system to use uinput: .PP KERNEL=="uinput", MODE="0666" .PP A more secure method uses the following line to allow anyone in to use wminput, and adds only the desired users to : .PP KERNEL=="uinput", GROUP="" .PP A uinput group can be created specifically for this purpose, or another existing group such as wheel can be used. .PP See usr/share/doc/wminput/wminput.conf.sample for an example wminput configuration file. Copy this file to ~/.CWiid/wminput.conf and change as desired. .PP Getting X to recognize non-standard key symbols, and mapping actions to those symbols, is not automatic. An excellent tutorial at http://gentoo-wiki.com/HOWTO_Use_Multimedia_Keys can help you set this up. An overview of the process (see the HOWTO for more information): .br 1.Edit ~/.CWiid/wminput.conf .br 2.Use xev, wminput, and your wiimote to find out if the key symbols are already mapped, and find the key codes if they are not. .br 3.If the codes are not mapped to the appropriate symbols, edit ~/.Xmodmap, and use xmodmap to map them. (A copy of my ~/.Xmodmap is included in CWiid/doc) .br 4.Use xbindkeys or a window manager-specific utility to map the key symbols to specific actions. .PP wminput tracking plugins are, by default, installed to /usr/lib/CWiid/plugins. Plugins may also be placed in ~/.CWiid/plugins, and plugins placed here will take precedence. .SH OPTIONS .TP .B \-h Show summary of options. .TP .B \-v, --version Output version information and exit. .TP .B \-c, --config [file] Choose config file to use. .TP .B \-d, --daemon Implies -q, -r, and -w. .TP .B \-q, --quiet Reduce output to errors .TP .B \-r, --reconnect [wait] Automatically try reconnect after wiimote disconnect. .TP .B \-w, --wait Wait indefinitely for wiimote to connect. .TP .B bdaddr Specify the wiimote bluetooth address. The bluetooth device address (bdaddr) of the wiimote can be specified on the command-line, or through the WIIMOTE_BDADDR environment variable, in the that order of precedence. If neither is given, the first wiimote found by hci_inquiry will be used. .SH SEE ALSO .BR wmgui (1), .br .SH AUTHOR wminput was written by L. Donnie Smith .PP This manual page was written by Romain Beauxis , for the Debian project (but may be used by others). cwiid-0.6.00+svn201/man/man1/wmgui.10000644000175000017500000000320110604073036015637 0ustar tootstoots.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH WMGUI 1 "janvier 18, 2007" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME wmgui \- GTK gui to the wiimote .SH SYNOPSIS .B wmgui .RI [ options ] .br .SH DESCRIPTION This manual page documents briefly the .B wmgui command. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. \fBwmgui\fP is a program that provides a simple GTK gui to the wiimote. .SH OPTIONS .TP .B \-h Show summary of options. .TP .B bdaddr Specify the wiimote bluetooth address. The bluetooth device address (bdaddr) of the wiimote can be specified on the command-line, or through the WIIMOTE_BDADDR environment variable, in the that order of precedence. If neither is given, the first wiimote found by hci_inquiry will be used. .SH SEE ALSO .BR wminput (1), .br .SH AUTHOR wmgui was written by L. Donnie Smith .PP This manual page was written by Romain Beauxis , for the Debian project (but may be used by others). cwiid-0.6.00+svn201/man/Makefile.in0000644000175000017500000000053710634140413015644 0ustar tootstoots#Copyright (C) 2007 L. Donnie Smith include @top_builddir@/defs.mak DEST_MAN_DIR = $(ROOTDIR)$(mandir) all: install: for f in `ls man?/*.?`; do \ install -D -m 644 $$f $(DEST_MAN_DIR)/$$f ; \ done uninstall: for f in `ls man?/*.?`; do \ rm -f $(DEST_MAN_DIR)/$$f ; \ done distclean: rm Makefile .PHONY: all install uninstall distclean cwiid-0.6.00+svn201/NEWS0000644000175000017500000000133310641062542013522 0ustar tootstoots0.6.00 - renamed libwiimote to libcwiid to avoid naming conflict with other projects - rewrite of libcwiid architecture - Python libcwiid interface - Python wminput plugins - rewrite of ir_ptr plugin 0.5.03 - Bugfixes, lswm utility, disconnect messages, wminput infinite wait 0.5.02 - Bugfixes, configure --disable-ldconfig 0.5.01 - Bugfixes 0.5.00 - Overhauled wminput configuration - wmdemo test application 0.4.01 - Bugfixes 0.4.00 - Status, Nunchuk, Classic Controller support 0.3.51 - Bugfixes 0.3.50 - Created plugin architecture - Acc calculations and plugin 0.3.01 - Bugfixes 0.3.00 - IR Reporting - wminput Event driver 0.2.00 - ACC Reporting - Memory Read/Write 0.1.00 - Initial Release cwiid-0.6.00+svn201/lswm/0000755000175000017500000000000011260043516014003 5ustar tootstootscwiid-0.6.00+svn201/lswm/Makefile.in0000644000175000017500000000045510652707447016072 0ustar tootstoots#Copyright (C) 2007 L. Donnie Smith include @top_builddir@/defs.mak APP_NAME = lswm SOURCES = lswm.c CFLAGS += -I@top_builddir@/libcwiid LDFLAGS += -L@top_builddir@/libcwiid LDLIBS += -lcwiid INST_DIR = @bindir@ include $(COMMON)/include/app.mak distclean: clean rm Makefile .PHONY: distclean cwiid-0.6.00+svn201/lswm/lswm.c0000644000175000017500000000720310652707447015151 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2007-07-28 L. Donnie Smith * * added config.h include * * use PACKAGE_VERSION from config.h instead of CWIID_VERSION * * 2007-06-01 Nick * * reworked command-line options (added standard options, long options) * * 2007-04-09 L. Donnie Smith * * updated for libcwiid rename * * 2007-04-07 L. Donnie Smith * * changed cwiid_info.class to btclass * * 2007-04-01 L. Donnie Smith * * created file */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include void print_usage(void) { printf("lswm lists availiable wiimotes\n"); printf("Usage: %s [OPTIONS]...\n\n", "lswm"); printf("Options:\n"); printf("\t-h, --help\t\tPrints this output.\n"); printf("\t-v, --version\t\toutput version information and exit.\n"); printf("\t-l, --long\t\tlong format (device details).\n"); printf("\t-q, --quiet\t\tquiet mode (less verbose).\n"); printf("\t-a, --all\t\tlist all bluetooth devices (not just wiimotes).\n"); } int main(int argc, char *argv[]) { int c; uint8_t flags = 0; char long_format = 0; char quiet = 0; struct cwiid_bdinfo *bdinfo; int bdinfo_count; int i; char ba_str[18]; /* Parse options */ while (1) { int option_index = 0; static struct option long_options[] = { {"help", 0, 0, 'h'}, {"all", 0, 0, 'a'}, {"long", 0, 0, 'l'}, {"version", 0, 0, 'v'}, {"quiet", 0, 0, 'q'}, {0, 0, 0, 0} }; c = getopt_long(argc, argv, "halvq", long_options, &option_index); if (c == -1) { break; } switch (c) { case 'h': print_usage(); return 0; break; case 'a': flags |= BT_NO_WIIMOTE_FILTER; break; case 'l': long_format = 1; break; case 'v': printf("CWiid Version %s\n", PACKAGE_VERSION); return 0; break; case 'q': quiet = 1; break; case '?': default: fprintf(stderr, "Try '%s --help' for more information\n", argv[0]); return -1; break; } } /* Handle quiet mode */ if (quiet) { cwiid_set_err(NULL); } /* Print discoverable mode message */ else if (flags & BT_NO_WIIMOTE_FILTER) { fprintf(stderr, "Put Bluetooth devices in discoverable mode now...\n"); } else { fprintf(stderr, "Put Wiimotes in discoverable mode now " "(press 1+2)...\n"); } /* Get device info */ if ((bdinfo_count = cwiid_get_bdinfo_array(-1, 2, -1, &bdinfo, flags)) == -1) { return -1; } /* Print info */ for (i=0; i < bdinfo_count; i++) { ba2str(&bdinfo[i].bdaddr, ba_str); if (long_format) { printf("%s 0x%.2X%.2X%.2X %s\n", ba_str, bdinfo[i].btclass[2], bdinfo[i].btclass[1], bdinfo[i].btclass[0], bdinfo[i].name); } else { printf("%s\n", ba_str); } } return 0; } cwiid-0.6.00+svn201/aclocal.m40000644000175000017500000001330111260043502014652 0ustar tootstoots# generated automatically by aclocal 1.11 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # # Similar to PKG_CHECK_MODULES, make sure that the first instance of # this or PKG_CHECK_MODULES is called, or make sure to call # PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_ifval([$2], [$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$PKG_CONFIG"; then if test -n "$$1"; then pkg_cv_[]$1="$$1" else PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) fi else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` else $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ifelse([$4], , [AC_MSG_ERROR(dnl [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT ])], [AC_MSG_RESULT([no]) $4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) ifelse([$3], , :, [$3]) fi[]dnl ])# PKG_CHECK_MODULES cwiid-0.6.00+svn201/wmgui/0000755000175000017500000000000011260043516014151 5ustar tootstootscwiid-0.6.00+svn201/wmgui/interface.c0000644000175000017500000021613710567071413016275 0ustar tootstoots/* * DO NOT EDIT THIS FILE - it is generated by Glade. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include #include #include "callbacks.h" #include "interface.h" #include "support.h" #define GLADE_HOOKUP_OBJECT(component,widget,name) \ g_object_set_data_full (G_OBJECT (component), name, \ gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ g_object_set_data (G_OBJECT (component), name, widget) GtkWidget* create_winMain (void) { GtkWidget *winMain; GtkWidget *vbox1; GtkWidget *menubar1; GtkWidget *menuitem1; GtkWidget *menuitem1_menu; GtkWidget *menuConnect; GtkWidget *image27; GtkWidget *menuDisconnect; GtkWidget *image28; GtkWidget *separatormenuitem1; GtkWidget *menuQuit; GtkWidget *image29; GtkWidget *menuSettings; GtkWidget *menuSettings_menu; GtkWidget *chkAcc; GtkWidget *chkIR; GtkWidget *chkExt; GtkWidget *menuControls; GtkWidget *menuControls_menu; GtkWidget *chkLED1; GtkWidget *chkLED2; GtkWidget *chkLED3; GtkWidget *chkLED4; GtkWidget *separator1; GtkWidget *chkRumble; GtkWidget *menuView; GtkWidget *menuView_menu; GtkWidget *menuRW; GtkWidget *menuHelp; GtkWidget *menuHelp_menu; GtkWidget *menuAbout; GtkWidget *hbox1; GtkWidget *frame1; GtkWidget *alignment1; GtkWidget *table1; GtkWidget *alignment3; GtkWidget *evUp; GtkWidget *lblUp; GtkWidget *alignment4; GtkWidget *evLeft; GtkWidget *lblLeft; GtkWidget *alignment5; GtkWidget *evRight; GtkWidget *lblRight; GtkWidget *alignment6; GtkWidget *evDown; GtkWidget *lblDown; GtkWidget *alignment7; GtkWidget *evA; GtkWidget *lblA; GtkWidget *alignment9; GtkWidget *evB; GtkWidget *lblB; GtkWidget *alignment10; GtkWidget *evMinus; GtkWidget *lblMinus; GtkWidget *alignment11; GtkWidget *evHome; GtkWidget *lblHome; GtkWidget *alignment12; GtkWidget *evPlus; GtkWidget *lblPlus; GtkWidget *alignment13; GtkWidget *ev1; GtkWidget *lbl1; GtkWidget *alignment14; GtkWidget *ev2; GtkWidget *lbl2; GtkWidget *label1; GtkWidget *frame2; GtkWidget *alignment2; GtkWidget *hbox2; GtkWidget *table4; GtkWidget *progAccX; GtkWidget *progAccY; GtkWidget *progAccZ; GtkWidget *lblAccX; GtkWidget *lblAccXVal; GtkWidget *lblAccY; GtkWidget *lblAccYVal; GtkWidget *lblAccZ; GtkWidget *lblAccZVal; GtkWidget *lblPitch; GtkWidget *lblPitchVal; GtkWidget *lblRoll; GtkWidget *lblRollVal; GtkWidget *lblAcc; GtkWidget *lblAccVal; GtkWidget *btnBeep; GtkWidget *frame3; GtkWidget *drawIR; GtkWidget *lblIR; GtkWidget *label2; GtkWidget *hbox10; GtkWidget *frame4; GtkWidget *alignment28; GtkWidget *hbox12; GtkWidget *vbox4; GtkWidget *drawNCStick; GtkWidget *hbox13; GtkWidget *evNCC; GtkWidget *lblNCC; GtkWidget *evNCZ; GtkWidget *lblNCZ; GtkWidget *table8; GtkWidget *lblNCAccX; GtkWidget *lblNCAccY; GtkWidget *lblNCAccZ; GtkWidget *lblNCAcc; GtkWidget *lblNCRoll; GtkWidget *lblNCPitch; GtkWidget *lblNCAccXVal; GtkWidget *lblNCAccYVal; GtkWidget *lblNCAccZVal; GtkWidget *lblNCAccVal; GtkWidget *lblNCRollVal; GtkWidget *lblNCPitchVal; GtkWidget *progNCAccX; GtkWidget *progNCAccZ; GtkWidget *progNCAccY; GtkWidget *lblNC; GtkWidget *frame5; GtkWidget *alignment29; GtkWidget *vbox5; GtkWidget *table9; GtkWidget *alignment15; GtkWidget *evCCLeft; GtkWidget *lblCCLeft; GtkWidget *alignment16; GtkWidget *evCCUp; GtkWidget *lblCCUp; GtkWidget *alignment17; GtkWidget *evCCDown; GtkWidget *lblCCDown; GtkWidget *alignment18; GtkWidget *evCCRight; GtkWidget *lblCCRight; GtkWidget *alignment19; GtkWidget *evCCMinus; GtkWidget *lblCCMinus; GtkWidget *alignment20; GtkWidget *evCCHome; GtkWidget *lblCCHome; GtkWidget *alignment21; GtkWidget *evCCPlus; GtkWidget *lblCCPlus; GtkWidget *alignment22; GtkWidget *evCCZL; GtkWidget *lblCCZL; GtkWidget *alignment23; GtkWidget *evCCZR; GtkWidget *lblCCZR; GtkWidget *alignment24; GtkWidget *evCCX; GtkWidget *lblCCX; GtkWidget *alignment25; GtkWidget *evCCY; GtkWidget *lblCCY; GtkWidget *alignment26; GtkWidget *evCCB; GtkWidget *lblCCB; GtkWidget *alignment27; GtkWidget *evCCA; GtkWidget *lblCCA; GtkWidget *hbox15; GtkWidget *drawCCLStick; GtkWidget *drawCCRStick; GtkWidget *table10; GtkWidget *lblCCLVal; GtkWidget *lblCCRVal; GtkWidget *progCCL; GtkWidget *progCCR; GtkWidget *evCCR; GtkWidget *lblCCR; GtkWidget *evCCL; GtkWidget *lblCCL; GtkWidget *lblClassic; GtkWidget *hbox11; GtkWidget *statConnection; GtkWidget *statBattery; GtkWidget *statExtension; GtkAccelGroup *accel_group; accel_group = gtk_accel_group_new (); winMain = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_name (winMain, "winMain"); gtk_window_set_title (GTK_WINDOW (winMain), "wmgui"); vbox1 = gtk_vbox_new (FALSE, 3); gtk_widget_set_name (vbox1, "vbox1"); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (winMain), vbox1); menubar1 = gtk_menu_bar_new (); gtk_widget_set_name (menubar1, "menubar1"); gtk_widget_show (menubar1); gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0); menuitem1 = gtk_menu_item_new_with_mnemonic ("_File"); gtk_widget_set_name (menuitem1, "menuitem1"); gtk_widget_show (menuitem1); gtk_container_add (GTK_CONTAINER (menubar1), menuitem1); menuitem1_menu = gtk_menu_new (); gtk_widget_set_name (menuitem1_menu, "menuitem1_menu"); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem1), menuitem1_menu); menuConnect = gtk_image_menu_item_new_with_mnemonic ("_Connect"); gtk_widget_set_name (menuConnect, "menuConnect"); gtk_widget_show (menuConnect); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menuConnect); gtk_widget_add_accelerator (menuConnect, "activate", accel_group, GDK_C, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); image27 = gtk_image_new_from_stock ("gtk-connect", GTK_ICON_SIZE_MENU); gtk_widget_set_name (image27, "image27"); gtk_widget_show (image27); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuConnect), image27); menuDisconnect = gtk_image_menu_item_new_with_mnemonic ("_Disconnect"); gtk_widget_set_name (menuDisconnect, "menuDisconnect"); gtk_widget_show (menuDisconnect); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menuDisconnect); gtk_widget_add_accelerator (menuDisconnect, "activate", accel_group, GDK_D, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); image28 = gtk_image_new_from_stock ("gtk-disconnect", GTK_ICON_SIZE_MENU); gtk_widget_set_name (image28, "image28"); gtk_widget_show (image28); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuDisconnect), image28); separatormenuitem1 = gtk_separator_menu_item_new (); gtk_widget_set_name (separatormenuitem1, "separatormenuitem1"); gtk_widget_show (separatormenuitem1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), separatormenuitem1); gtk_widget_set_sensitive (separatormenuitem1, FALSE); menuQuit = gtk_image_menu_item_new_with_mnemonic ("_Quit"); gtk_widget_set_name (menuQuit, "menuQuit"); gtk_widget_show (menuQuit); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menuQuit); gtk_widget_add_accelerator (menuQuit, "activate", accel_group, GDK_Q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); image29 = gtk_image_new_from_stock ("gtk-quit", GTK_ICON_SIZE_MENU); gtk_widget_set_name (image29, "image29"); gtk_widget_show (image29); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuQuit), image29); menuSettings = gtk_menu_item_new_with_mnemonic ("_Settings"); gtk_widget_set_name (menuSettings, "menuSettings"); gtk_widget_show (menuSettings); gtk_container_add (GTK_CONTAINER (menubar1), menuSettings); menuSettings_menu = gtk_menu_new (); gtk_widget_set_name (menuSettings_menu, "menuSettings_menu"); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuSettings), menuSettings_menu); chkAcc = gtk_check_menu_item_new_with_mnemonic ("_Acc Data"); gtk_widget_set_name (chkAcc, "chkAcc"); gtk_widget_show (chkAcc); gtk_container_add (GTK_CONTAINER (menuSettings_menu), chkAcc); gtk_widget_add_accelerator (chkAcc, "activate", accel_group, GDK_A, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); chkIR = gtk_check_menu_item_new_with_mnemonic ("_IR Data"); gtk_widget_set_name (chkIR, "chkIR"); gtk_widget_show (chkIR); gtk_container_add (GTK_CONTAINER (menuSettings_menu), chkIR); gtk_widget_add_accelerator (chkIR, "activate", accel_group, GDK_I, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); chkExt = gtk_check_menu_item_new_with_mnemonic ("_Extension Data"); gtk_widget_set_name (chkExt, "chkExt"); gtk_widget_show (chkExt); gtk_container_add (GTK_CONTAINER (menuSettings_menu), chkExt); gtk_widget_add_accelerator (chkExt, "activate", accel_group, GDK_E, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); menuControls = gtk_menu_item_new_with_mnemonic ("_Controls"); gtk_widget_set_name (menuControls, "menuControls"); gtk_widget_show (menuControls); gtk_container_add (GTK_CONTAINER (menubar1), menuControls); menuControls_menu = gtk_menu_new (); gtk_widget_set_name (menuControls_menu, "menuControls_menu"); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuControls), menuControls_menu); chkLED1 = gtk_check_menu_item_new_with_mnemonic ("LED _1"); gtk_widget_set_name (chkLED1, "chkLED1"); gtk_widget_show (chkLED1); gtk_container_add (GTK_CONTAINER (menuControls_menu), chkLED1); gtk_widget_add_accelerator (chkLED1, "activate", accel_group, GDK_1, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); chkLED2 = gtk_check_menu_item_new_with_mnemonic ("LED _2"); gtk_widget_set_name (chkLED2, "chkLED2"); gtk_widget_show (chkLED2); gtk_container_add (GTK_CONTAINER (menuControls_menu), chkLED2); gtk_widget_add_accelerator (chkLED2, "activate", accel_group, GDK_2, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); chkLED3 = gtk_check_menu_item_new_with_mnemonic ("LED _3"); gtk_widget_set_name (chkLED3, "chkLED3"); gtk_widget_show (chkLED3); gtk_container_add (GTK_CONTAINER (menuControls_menu), chkLED3); gtk_widget_add_accelerator (chkLED3, "activate", accel_group, GDK_3, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); chkLED4 = gtk_check_menu_item_new_with_mnemonic ("LED _4"); gtk_widget_set_name (chkLED4, "chkLED4"); gtk_widget_show (chkLED4); gtk_container_add (GTK_CONTAINER (menuControls_menu), chkLED4); gtk_widget_add_accelerator (chkLED4, "activate", accel_group, GDK_4, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); separator1 = gtk_separator_menu_item_new (); gtk_widget_set_name (separator1, "separator1"); gtk_widget_show (separator1); gtk_container_add (GTK_CONTAINER (menuControls_menu), separator1); gtk_widget_set_sensitive (separator1, FALSE); chkRumble = gtk_check_menu_item_new_with_mnemonic ("_Rumble"); gtk_widget_set_name (chkRumble, "chkRumble"); gtk_widget_show (chkRumble); gtk_container_add (GTK_CONTAINER (menuControls_menu), chkRumble); gtk_widget_add_accelerator (chkRumble, "activate", accel_group, GDK_R, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); menuView = gtk_menu_item_new_with_mnemonic ("_View"); gtk_widget_set_name (menuView, "menuView"); gtk_widget_show (menuView); gtk_container_add (GTK_CONTAINER (menubar1), menuView); menuView_menu = gtk_menu_new (); gtk_widget_set_name (menuView_menu, "menuView_menu"); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuView), menuView_menu); menuRW = gtk_menu_item_new_with_mnemonic ("_Memory Read/Write"); gtk_widget_set_name (menuRW, "menuRW"); gtk_widget_show (menuRW); gtk_container_add (GTK_CONTAINER (menuView_menu), menuRW); gtk_widget_add_accelerator (menuRW, "activate", accel_group, GDK_M, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); menuHelp = gtk_menu_item_new_with_mnemonic ("_Help"); gtk_widget_set_name (menuHelp, "menuHelp"); gtk_widget_show (menuHelp); gtk_container_add (GTK_CONTAINER (menubar1), menuHelp); menuHelp_menu = gtk_menu_new (); gtk_widget_set_name (menuHelp_menu, "menuHelp_menu"); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuHelp), menuHelp_menu); menuAbout = gtk_menu_item_new_with_mnemonic ("_About"); gtk_widget_set_name (menuAbout, "menuAbout"); gtk_widget_show (menuAbout); gtk_container_add (GTK_CONTAINER (menuHelp_menu), menuAbout); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox1, "hbox1"); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0); frame1 = gtk_frame_new (NULL); gtk_widget_set_name (frame1, "frame1"); gtk_widget_show (frame1); gtk_box_pack_start (GTK_BOX (hbox1), frame1, TRUE, TRUE, 3); alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment1, "alignment1"); gtk_widget_show (alignment1); gtk_container_add (GTK_CONTAINER (frame1), alignment1); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0); table1 = gtk_table_new (6, 3, TRUE); gtk_widget_set_name (table1, "table1"); gtk_widget_show (table1); gtk_container_add (GTK_CONTAINER (alignment1), table1); alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment3, "alignment3"); gtk_widget_show (alignment3); gtk_table_attach (GTK_TABLE (table1), alignment3, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); evUp = gtk_event_box_new (); gtk_widget_set_name (evUp, "evUp"); gtk_widget_show (evUp); gtk_container_add (GTK_CONTAINER (alignment3), evUp); lblUp = gtk_label_new ("Up"); gtk_widget_set_name (lblUp, "lblUp"); gtk_widget_show (lblUp); gtk_container_add (GTK_CONTAINER (evUp), lblUp); alignment4 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment4, "alignment4"); gtk_widget_show (alignment4); gtk_table_attach (GTK_TABLE (table1), alignment4, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); evLeft = gtk_event_box_new (); gtk_widget_set_name (evLeft, "evLeft"); gtk_widget_show (evLeft); gtk_container_add (GTK_CONTAINER (alignment4), evLeft); lblLeft = gtk_label_new ("Left"); gtk_widget_set_name (lblLeft, "lblLeft"); gtk_widget_show (lblLeft); gtk_container_add (GTK_CONTAINER (evLeft), lblLeft); alignment5 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment5, "alignment5"); gtk_widget_show (alignment5); gtk_table_attach (GTK_TABLE (table1), alignment5, 2, 3, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evRight = gtk_event_box_new (); gtk_widget_set_name (evRight, "evRight"); gtk_widget_show (evRight); gtk_container_add (GTK_CONTAINER (alignment5), evRight); lblRight = gtk_label_new ("Right"); gtk_widget_set_name (lblRight, "lblRight"); gtk_widget_show (lblRight); gtk_container_add (GTK_CONTAINER (evRight), lblRight); alignment6 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment6, "alignment6"); gtk_widget_show (alignment6); gtk_table_attach (GTK_TABLE (table1), alignment6, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); evDown = gtk_event_box_new (); gtk_widget_set_name (evDown, "evDown"); gtk_widget_show (evDown); gtk_container_add (GTK_CONTAINER (alignment6), evDown); lblDown = gtk_label_new ("Down"); gtk_widget_set_name (lblDown, "lblDown"); gtk_widget_show (lblDown); gtk_container_add (GTK_CONTAINER (evDown), lblDown); alignment7 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment7, "alignment7"); gtk_widget_show (alignment7); gtk_table_attach (GTK_TABLE (table1), alignment7, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); evA = gtk_event_box_new (); gtk_widget_set_name (evA, "evA"); gtk_widget_show (evA); gtk_container_add (GTK_CONTAINER (alignment7), evA); lblA = gtk_label_new ("A"); gtk_widget_set_name (lblA, "lblA"); gtk_widget_show (lblA); gtk_container_add (GTK_CONTAINER (evA), lblA); alignment9 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment9, "alignment9"); gtk_widget_show (alignment9); gtk_table_attach (GTK_TABLE (table1), alignment9, 2, 3, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evB = gtk_event_box_new (); gtk_widget_set_name (evB, "evB"); gtk_widget_show (evB); gtk_container_add (GTK_CONTAINER (alignment9), evB); lblB = gtk_label_new ("B"); gtk_widget_set_name (lblB, "lblB"); gtk_widget_show (lblB); gtk_container_add (GTK_CONTAINER (evB), lblB); alignment10 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment10, "alignment10"); gtk_widget_show (alignment10); gtk_table_attach (GTK_TABLE (table1), alignment10, 0, 1, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); evMinus = gtk_event_box_new (); gtk_widget_set_name (evMinus, "evMinus"); gtk_widget_show (evMinus); gtk_container_add (GTK_CONTAINER (alignment10), evMinus); lblMinus = gtk_label_new ("-"); gtk_widget_set_name (lblMinus, "lblMinus"); gtk_widget_show (lblMinus); gtk_container_add (GTK_CONTAINER (evMinus), lblMinus); alignment11 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment11, "alignment11"); gtk_widget_show (alignment11); gtk_table_attach (GTK_TABLE (table1), alignment11, 1, 2, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evHome = gtk_event_box_new (); gtk_widget_set_name (evHome, "evHome"); gtk_widget_show (evHome); gtk_container_add (GTK_CONTAINER (alignment11), evHome); lblHome = gtk_label_new ("Home"); gtk_widget_set_name (lblHome, "lblHome"); gtk_widget_show (lblHome); gtk_container_add (GTK_CONTAINER (evHome), lblHome); alignment12 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment12, "alignment12"); gtk_widget_show (alignment12); gtk_table_attach (GTK_TABLE (table1), alignment12, 2, 3, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evPlus = gtk_event_box_new (); gtk_widget_set_name (evPlus, "evPlus"); gtk_widget_show (evPlus); gtk_container_add (GTK_CONTAINER (alignment12), evPlus); lblPlus = gtk_label_new ("+"); gtk_widget_set_name (lblPlus, "lblPlus"); gtk_widget_show (lblPlus); gtk_container_add (GTK_CONTAINER (evPlus), lblPlus); alignment13 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment13, "alignment13"); gtk_widget_show (alignment13); gtk_table_attach (GTK_TABLE (table1), alignment13, 0, 1, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); ev1 = gtk_event_box_new (); gtk_widget_set_name (ev1, "ev1"); gtk_widget_show (ev1); gtk_container_add (GTK_CONTAINER (alignment13), ev1); lbl1 = gtk_label_new ("1"); gtk_widget_set_name (lbl1, "lbl1"); gtk_widget_show (lbl1); gtk_container_add (GTK_CONTAINER (ev1), lbl1); alignment14 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment14, "alignment14"); gtk_widget_show (alignment14); gtk_table_attach (GTK_TABLE (table1), alignment14, 2, 3, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); ev2 = gtk_event_box_new (); gtk_widget_set_name (ev2, "ev2"); gtk_widget_show (ev2); gtk_container_add (GTK_CONTAINER (alignment14), ev2); lbl2 = gtk_label_new ("2"); gtk_widget_set_name (lbl2, "lbl2"); gtk_widget_show (lbl2); gtk_container_add (GTK_CONTAINER (ev2), lbl2); label1 = gtk_label_new ("Buttons"); gtk_widget_set_name (label1, "label1"); gtk_widget_show (label1); gtk_frame_set_label_widget (GTK_FRAME (frame1), label1); gtk_label_set_use_markup (GTK_LABEL (label1), TRUE); frame2 = gtk_frame_new (NULL); gtk_widget_set_name (frame2, "frame2"); gtk_widget_show (frame2); gtk_box_pack_start (GTK_BOX (hbox1), frame2, TRUE, TRUE, 3); alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment2, "alignment2"); gtk_widget_show (alignment2); gtk_container_add (GTK_CONTAINER (frame2), alignment2); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 0, 0, 12, 0); hbox2 = gtk_hbox_new (TRUE, 6); gtk_widget_set_name (hbox2, "hbox2"); gtk_widget_show (hbox2); gtk_container_add (GTK_CONTAINER (alignment2), hbox2); table4 = gtk_table_new (6, 3, FALSE); gtk_widget_set_name (table4, "table4"); gtk_widget_show (table4); gtk_box_pack_start (GTK_BOX (hbox2), table4, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table4), 3); progAccX = gtk_progress_bar_new (); gtk_widget_set_name (progAccX, "progAccX"); gtk_widget_show (progAccX); gtk_table_attach (GTK_TABLE (table4), progAccX, 2, 3, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (progAccX, FALSE); progAccY = gtk_progress_bar_new (); gtk_widget_set_name (progAccY, "progAccY"); gtk_widget_show (progAccY); gtk_table_attach (GTK_TABLE (table4), progAccY, 2, 3, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (progAccY, FALSE); progAccZ = gtk_progress_bar_new (); gtk_widget_set_name (progAccZ, "progAccZ"); gtk_widget_show (progAccZ); gtk_table_attach (GTK_TABLE (table4), progAccZ, 2, 3, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (progAccZ, FALSE); lblAccX = gtk_label_new ("X:"); gtk_widget_set_name (lblAccX, "lblAccX"); gtk_widget_show (lblAccX); gtk_table_attach (GTK_TABLE (table4), lblAccX, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblAccX, FALSE); gtk_label_set_justify (GTK_LABEL (lblAccX), GTK_JUSTIFY_RIGHT); gtk_misc_set_alignment (GTK_MISC (lblAccX), 0, 0.5); lblAccXVal = gtk_label_new ("0"); gtk_widget_set_name (lblAccXVal, "lblAccXVal"); gtk_widget_show (lblAccXVal); gtk_table_attach (GTK_TABLE (table4), lblAccXVal, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblAccXVal, 35, -1); gtk_widget_set_sensitive (lblAccXVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblAccXVal), 0, 0.5); lblAccY = gtk_label_new ("Y:"); gtk_widget_set_name (lblAccY, "lblAccY"); gtk_widget_show (lblAccY); gtk_table_attach (GTK_TABLE (table4), lblAccY, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblAccY, FALSE); gtk_label_set_justify (GTK_LABEL (lblAccY), GTK_JUSTIFY_RIGHT); gtk_misc_set_alignment (GTK_MISC (lblAccY), 0, 0.5); lblAccYVal = gtk_label_new ("0"); gtk_widget_set_name (lblAccYVal, "lblAccYVal"); gtk_widget_show (lblAccYVal); gtk_table_attach (GTK_TABLE (table4), lblAccYVal, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblAccYVal, 35, -1); gtk_widget_set_sensitive (lblAccYVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblAccYVal), 0, 0.5); lblAccZ = gtk_label_new ("Z:"); gtk_widget_set_name (lblAccZ, "lblAccZ"); gtk_widget_show (lblAccZ); gtk_table_attach (GTK_TABLE (table4), lblAccZ, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblAccZ, FALSE); gtk_label_set_justify (GTK_LABEL (lblAccZ), GTK_JUSTIFY_RIGHT); gtk_misc_set_alignment (GTK_MISC (lblAccZ), 0, 0.5); lblAccZVal = gtk_label_new ("0"); gtk_widget_set_name (lblAccZVal, "lblAccZVal"); gtk_widget_show (lblAccZVal); gtk_table_attach (GTK_TABLE (table4), lblAccZVal, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblAccZVal, 35, -1); gtk_widget_set_sensitive (lblAccZVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblAccZVal), 0, 0.5); lblPitch = gtk_label_new ("Pitch:"); gtk_widget_set_name (lblPitch, "lblPitch"); gtk_widget_show (lblPitch); gtk_table_attach (GTK_TABLE (table4), lblPitch, 0, 1, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblPitch, FALSE); gtk_label_set_justify (GTK_LABEL (lblPitch), GTK_JUSTIFY_RIGHT); gtk_misc_set_alignment (GTK_MISC (lblPitch), 0, 0.5); lblPitchVal = gtk_label_new ("0"); gtk_widget_set_name (lblPitchVal, "lblPitchVal"); gtk_widget_show (lblPitchVal); gtk_table_attach (GTK_TABLE (table4), lblPitchVal, 1, 2, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblPitchVal, 35, -1); gtk_widget_set_sensitive (lblPitchVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblPitchVal), 0, 0.5); lblRoll = gtk_label_new ("Roll:"); gtk_widget_set_name (lblRoll, "lblRoll"); gtk_widget_show (lblRoll); gtk_table_attach (GTK_TABLE (table4), lblRoll, 0, 1, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblRoll, FALSE); gtk_label_set_justify (GTK_LABEL (lblRoll), GTK_JUSTIFY_RIGHT); gtk_misc_set_alignment (GTK_MISC (lblRoll), 0, 0.5); lblRollVal = gtk_label_new ("0"); gtk_widget_set_name (lblRollVal, "lblRollVal"); gtk_widget_show (lblRollVal); gtk_table_attach (GTK_TABLE (table4), lblRollVal, 1, 2, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblRollVal, 35, -1); gtk_widget_set_sensitive (lblRollVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblRollVal), 0, 0.5); lblAcc = gtk_label_new ("Acc:"); gtk_widget_set_name (lblAcc, "lblAcc"); gtk_widget_show (lblAcc); gtk_table_attach (GTK_TABLE (table4), lblAcc, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblAcc, FALSE); gtk_misc_set_alignment (GTK_MISC (lblAcc), 0, 0.5); lblAccVal = gtk_label_new ("0"); gtk_widget_set_name (lblAccVal, "lblAccVal"); gtk_widget_show (lblAccVal); gtk_table_attach (GTK_TABLE (table4), lblAccVal, 1, 2, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblAccVal, 35, -1); gtk_widget_set_sensitive (lblAccVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblAccVal), 0, 0.5); btnBeep = gtk_button_new_with_mnemonic ("Beep"); gtk_widget_set_name (btnBeep, "btnBeep"); gtk_table_attach (GTK_TABLE (table4), btnBeep, 2, 3, 4, 5, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); frame3 = gtk_frame_new (NULL); gtk_widget_set_name (frame3, "frame3"); gtk_widget_show (frame3); gtk_box_pack_start (GTK_BOX (hbox2), frame3, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (frame3), 4); gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_IN); drawIR = gtk_drawing_area_new (); gtk_widget_set_name (drawIR, "drawIR"); gtk_widget_show (drawIR); gtk_container_add (GTK_CONTAINER (frame3), drawIR); lblIR = gtk_label_new ("IR"); gtk_widget_set_name (lblIR, "lblIR"); gtk_widget_show (lblIR); gtk_frame_set_label_widget (GTK_FRAME (frame3), lblIR); gtk_widget_set_sensitive (lblIR, FALSE); gtk_label_set_use_markup (GTK_LABEL (lblIR), TRUE); label2 = gtk_label_new ("Motion Sensors"); gtk_widget_set_name (label2, "label2"); gtk_widget_show (label2); gtk_frame_set_label_widget (GTK_FRAME (frame2), label2); gtk_label_set_use_markup (GTK_LABEL (label2), TRUE); hbox10 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox10, "hbox10"); gtk_widget_show (hbox10); gtk_box_pack_start (GTK_BOX (vbox1), hbox10, FALSE, FALSE, 0); frame4 = gtk_frame_new (NULL); gtk_widget_set_name (frame4, "frame4"); gtk_widget_show (frame4); gtk_box_pack_start (GTK_BOX (hbox10), frame4, TRUE, TRUE, 3); alignment28 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment28, "alignment28"); gtk_widget_show (alignment28); gtk_container_add (GTK_CONTAINER (frame4), alignment28); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment28), 0, 0, 12, 0); hbox12 = gtk_hbox_new (FALSE, 4); gtk_widget_set_name (hbox12, "hbox12"); gtk_widget_show (hbox12); gtk_container_add (GTK_CONTAINER (alignment28), hbox12); vbox4 = gtk_vbox_new (FALSE, 0); gtk_widget_set_name (vbox4, "vbox4"); gtk_widget_show (vbox4); gtk_box_pack_start (GTK_BOX (hbox12), vbox4, TRUE, TRUE, 0); drawNCStick = gtk_drawing_area_new (); gtk_widget_set_name (drawNCStick, "drawNCStick"); gtk_widget_show (drawNCStick); gtk_box_pack_start (GTK_BOX (vbox4), drawNCStick, TRUE, FALSE, 0); gtk_widget_set_size_request (drawNCStick, 50, 50); hbox13 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox13, "hbox13"); gtk_widget_show (hbox13); gtk_box_pack_start (GTK_BOX (vbox4), hbox13, TRUE, FALSE, 0); evNCC = gtk_event_box_new (); gtk_widget_set_name (evNCC, "evNCC"); gtk_widget_show (evNCC); gtk_box_pack_start (GTK_BOX (hbox13), evNCC, TRUE, TRUE, 0); lblNCC = gtk_label_new ("C"); gtk_widget_set_name (lblNCC, "lblNCC"); gtk_widget_show (lblNCC); gtk_container_add (GTK_CONTAINER (evNCC), lblNCC); evNCZ = gtk_event_box_new (); gtk_widget_set_name (evNCZ, "evNCZ"); gtk_widget_show (evNCZ); gtk_box_pack_start (GTK_BOX (hbox13), evNCZ, TRUE, TRUE, 0); lblNCZ = gtk_label_new ("Z"); gtk_widget_set_name (lblNCZ, "lblNCZ"); gtk_widget_show (lblNCZ); gtk_container_add (GTK_CONTAINER (evNCZ), lblNCZ); table8 = gtk_table_new (6, 3, FALSE); gtk_widget_set_name (table8, "table8"); gtk_widget_show (table8); gtk_box_pack_start (GTK_BOX (hbox12), table8, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table8), 3); lblNCAccX = gtk_label_new ("X:"); gtk_widget_set_name (lblNCAccX, "lblNCAccX"); gtk_widget_show (lblNCAccX); gtk_table_attach (GTK_TABLE (table8), lblNCAccX, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblNCAccX, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCAccX), 0, 0.5); lblNCAccY = gtk_label_new ("Y:"); gtk_widget_set_name (lblNCAccY, "lblNCAccY"); gtk_widget_show (lblNCAccY); gtk_table_attach (GTK_TABLE (table8), lblNCAccY, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblNCAccY, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCAccY), 0, 0.5); lblNCAccZ = gtk_label_new ("Z:"); gtk_widget_set_name (lblNCAccZ, "lblNCAccZ"); gtk_widget_show (lblNCAccZ); gtk_table_attach (GTK_TABLE (table8), lblNCAccZ, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblNCAccZ, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCAccZ), 0, 0.5); lblNCAcc = gtk_label_new ("Acc:"); gtk_widget_set_name (lblNCAcc, "lblNCAcc"); gtk_widget_show (lblNCAcc); gtk_table_attach (GTK_TABLE (table8), lblNCAcc, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblNCAcc, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCAcc), 0, 0.5); lblNCRoll = gtk_label_new ("Roll:"); gtk_widget_set_name (lblNCRoll, "lblNCRoll"); gtk_widget_show (lblNCRoll); gtk_table_attach (GTK_TABLE (table8), lblNCRoll, 0, 1, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblNCRoll, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCRoll), 0, 0.5); lblNCPitch = gtk_label_new ("Pitch:"); gtk_widget_set_name (lblNCPitch, "lblNCPitch"); gtk_widget_show (lblNCPitch); gtk_table_attach (GTK_TABLE (table8), lblNCPitch, 0, 1, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (lblNCPitch, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCPitch), 0, 0.5); lblNCAccXVal = gtk_label_new ("0"); gtk_widget_set_name (lblNCAccXVal, "lblNCAccXVal"); gtk_widget_show (lblNCAccXVal); gtk_table_attach (GTK_TABLE (table8), lblNCAccXVal, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblNCAccXVal, 35, -1); gtk_widget_set_sensitive (lblNCAccXVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCAccXVal), 0, 0.5); lblNCAccYVal = gtk_label_new ("0"); gtk_widget_set_name (lblNCAccYVal, "lblNCAccYVal"); gtk_widget_show (lblNCAccYVal); gtk_table_attach (GTK_TABLE (table8), lblNCAccYVal, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblNCAccYVal, 35, -1); gtk_widget_set_sensitive (lblNCAccYVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCAccYVal), 0, 0.5); lblNCAccZVal = gtk_label_new ("0"); gtk_widget_set_name (lblNCAccZVal, "lblNCAccZVal"); gtk_widget_show (lblNCAccZVal); gtk_table_attach (GTK_TABLE (table8), lblNCAccZVal, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblNCAccZVal, 35, -1); gtk_widget_set_sensitive (lblNCAccZVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCAccZVal), 0, 0.5); lblNCAccVal = gtk_label_new ("0"); gtk_widget_set_name (lblNCAccVal, "lblNCAccVal"); gtk_widget_show (lblNCAccVal); gtk_table_attach (GTK_TABLE (table8), lblNCAccVal, 1, 2, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblNCAccVal, 35, -1); gtk_widget_set_sensitive (lblNCAccVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCAccVal), 0, 0.5); lblNCRollVal = gtk_label_new ("0"); gtk_widget_set_name (lblNCRollVal, "lblNCRollVal"); gtk_widget_show (lblNCRollVal); gtk_table_attach (GTK_TABLE (table8), lblNCRollVal, 1, 2, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblNCRollVal, 35, -1); gtk_widget_set_sensitive (lblNCRollVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCRollVal), 0, 0.5); lblNCPitchVal = gtk_label_new ("0"); gtk_widget_set_name (lblNCPitchVal, "lblNCPitchVal"); gtk_widget_show (lblNCPitchVal); gtk_table_attach (GTK_TABLE (table8), lblNCPitchVal, 1, 2, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblNCPitchVal, 35, -1); gtk_widget_set_sensitive (lblNCPitchVal, FALSE); gtk_misc_set_alignment (GTK_MISC (lblNCPitchVal), 0, 0.5); progNCAccX = gtk_progress_bar_new (); gtk_widget_set_name (progNCAccX, "progNCAccX"); gtk_widget_show (progNCAccX); gtk_table_attach (GTK_TABLE (table8), progNCAccX, 2, 3, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (progNCAccX, FALSE); progNCAccZ = gtk_progress_bar_new (); gtk_widget_set_name (progNCAccZ, "progNCAccZ"); gtk_widget_show (progNCAccZ); gtk_table_attach (GTK_TABLE (table8), progNCAccZ, 2, 3, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (progNCAccZ, FALSE); progNCAccY = gtk_progress_bar_new (); gtk_widget_set_name (progNCAccY, "progNCAccY"); gtk_widget_show (progNCAccY); gtk_table_attach (GTK_TABLE (table8), progNCAccY, 2, 3, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (progNCAccY, FALSE); lblNC = gtk_label_new ("Nunchuk"); gtk_widget_set_name (lblNC, "lblNC"); gtk_widget_show (lblNC); gtk_frame_set_label_widget (GTK_FRAME (frame4), lblNC); gtk_label_set_use_markup (GTK_LABEL (lblNC), TRUE); frame5 = gtk_frame_new (NULL); gtk_widget_set_name (frame5, "frame5"); gtk_widget_show (frame5); gtk_box_pack_start (GTK_BOX (hbox10), frame5, TRUE, TRUE, 3); alignment29 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment29, "alignment29"); gtk_widget_show (alignment29); gtk_container_add (GTK_CONTAINER (frame5), alignment29); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment29), 0, 0, 12, 0); vbox5 = gtk_vbox_new (FALSE, 5); gtk_widget_set_name (vbox5, "vbox5"); gtk_widget_show (vbox5); gtk_container_add (GTK_CONTAINER (alignment29), vbox5); table9 = gtk_table_new (3, 9, TRUE); gtk_widget_set_name (table9, "table9"); gtk_widget_show (table9); gtk_box_pack_start (GTK_BOX (vbox5), table9, TRUE, TRUE, 0); alignment15 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment15, "alignment15"); gtk_widget_show (alignment15); gtk_table_attach (GTK_TABLE (table9), alignment15, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); evCCLeft = gtk_event_box_new (); gtk_widget_set_name (evCCLeft, "evCCLeft"); gtk_widget_show (evCCLeft); gtk_container_add (GTK_CONTAINER (alignment15), evCCLeft); lblCCLeft = gtk_label_new ("Left"); gtk_widget_set_name (lblCCLeft, "lblCCLeft"); gtk_widget_show (lblCCLeft); gtk_container_add (GTK_CONTAINER (evCCLeft), lblCCLeft); alignment16 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment16, "alignment16"); gtk_widget_show (alignment16); gtk_table_attach (GTK_TABLE (table9), alignment16, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); evCCUp = gtk_event_box_new (); gtk_widget_set_name (evCCUp, "evCCUp"); gtk_widget_show (evCCUp); gtk_container_add (GTK_CONTAINER (alignment16), evCCUp); lblCCUp = gtk_label_new ("Up"); gtk_widget_set_name (lblCCUp, "lblCCUp"); gtk_widget_show (lblCCUp); gtk_container_add (GTK_CONTAINER (evCCUp), lblCCUp); alignment17 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment17, "alignment17"); gtk_widget_show (alignment17); gtk_table_attach (GTK_TABLE (table9), alignment17, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); evCCDown = gtk_event_box_new (); gtk_widget_set_name (evCCDown, "evCCDown"); gtk_widget_show (evCCDown); gtk_container_add (GTK_CONTAINER (alignment17), evCCDown); lblCCDown = gtk_label_new ("Down"); gtk_widget_set_name (lblCCDown, "lblCCDown"); gtk_widget_show (lblCCDown); gtk_container_add (GTK_CONTAINER (evCCDown), lblCCDown); alignment18 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment18, "alignment18"); gtk_widget_show (alignment18); gtk_table_attach (GTK_TABLE (table9), alignment18, 2, 3, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evCCRight = gtk_event_box_new (); gtk_widget_set_name (evCCRight, "evCCRight"); gtk_widget_show (evCCRight); gtk_container_add (GTK_CONTAINER (alignment18), evCCRight); lblCCRight = gtk_label_new ("Right"); gtk_widget_set_name (lblCCRight, "lblCCRight"); gtk_widget_show (lblCCRight); gtk_container_add (GTK_CONTAINER (evCCRight), lblCCRight); alignment19 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment19, "alignment19"); gtk_widget_show (alignment19); gtk_table_attach (GTK_TABLE (table9), alignment19, 3, 4, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evCCMinus = gtk_event_box_new (); gtk_widget_set_name (evCCMinus, "evCCMinus"); gtk_widget_show (evCCMinus); gtk_container_add (GTK_CONTAINER (alignment19), evCCMinus); lblCCMinus = gtk_label_new ("-"); gtk_widget_set_name (lblCCMinus, "lblCCMinus"); gtk_widget_show (lblCCMinus); gtk_container_add (GTK_CONTAINER (evCCMinus), lblCCMinus); alignment20 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment20, "alignment20"); gtk_widget_show (alignment20); gtk_table_attach (GTK_TABLE (table9), alignment20, 4, 5, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evCCHome = gtk_event_box_new (); gtk_widget_set_name (evCCHome, "evCCHome"); gtk_widget_show (evCCHome); gtk_container_add (GTK_CONTAINER (alignment20), evCCHome); lblCCHome = gtk_label_new ("Home"); gtk_widget_set_name (lblCCHome, "lblCCHome"); gtk_widget_show (lblCCHome); gtk_container_add (GTK_CONTAINER (evCCHome), lblCCHome); alignment21 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment21, "alignment21"); gtk_widget_show (alignment21); gtk_table_attach (GTK_TABLE (table9), alignment21, 5, 6, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evCCPlus = gtk_event_box_new (); gtk_widget_set_name (evCCPlus, "evCCPlus"); gtk_widget_show (evCCPlus); gtk_container_add (GTK_CONTAINER (alignment21), evCCPlus); lblCCPlus = gtk_label_new ("+"); gtk_widget_set_name (lblCCPlus, "lblCCPlus"); gtk_widget_show (lblCCPlus); gtk_container_add (GTK_CONTAINER (evCCPlus), lblCCPlus); alignment22 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment22, "alignment22"); gtk_widget_show (alignment22); gtk_table_attach (GTK_TABLE (table9), alignment22, 3, 4, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evCCZL = gtk_event_box_new (); gtk_widget_set_name (evCCZL, "evCCZL"); gtk_widget_show (evCCZL); gtk_container_add (GTK_CONTAINER (alignment22), evCCZL); lblCCZL = gtk_label_new ("ZL"); gtk_widget_set_name (lblCCZL, "lblCCZL"); gtk_widget_show (lblCCZL); gtk_container_add (GTK_CONTAINER (evCCZL), lblCCZL); alignment23 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment23, "alignment23"); gtk_widget_show (alignment23); gtk_table_attach (GTK_TABLE (table9), alignment23, 5, 6, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evCCZR = gtk_event_box_new (); gtk_widget_set_name (evCCZR, "evCCZR"); gtk_widget_show (evCCZR); gtk_container_add (GTK_CONTAINER (alignment23), evCCZR); lblCCZR = gtk_label_new ("ZR"); gtk_widget_set_name (lblCCZR, "lblCCZR"); gtk_widget_show (lblCCZR); gtk_container_add (GTK_CONTAINER (evCCZR), lblCCZR); alignment24 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment24, "alignment24"); gtk_widget_show (alignment24); gtk_table_attach (GTK_TABLE (table9), alignment24, 7, 8, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evCCX = gtk_event_box_new (); gtk_widget_set_name (evCCX, "evCCX"); gtk_widget_show (evCCX); gtk_container_add (GTK_CONTAINER (alignment24), evCCX); lblCCX = gtk_label_new ("X"); gtk_widget_set_name (lblCCX, "lblCCX"); gtk_widget_show (lblCCX); gtk_container_add (GTK_CONTAINER (evCCX), lblCCX); alignment25 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment25, "alignment25"); gtk_widget_show (alignment25); gtk_table_attach (GTK_TABLE (table9), alignment25, 6, 7, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evCCY = gtk_event_box_new (); gtk_widget_set_name (evCCY, "evCCY"); gtk_widget_show (evCCY); gtk_container_add (GTK_CONTAINER (alignment25), evCCY); lblCCY = gtk_label_new ("Y"); gtk_widget_set_name (lblCCY, "lblCCY"); gtk_widget_show (lblCCY); gtk_container_add (GTK_CONTAINER (evCCY), lblCCY); alignment26 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment26, "alignment26"); gtk_widget_show (alignment26); gtk_table_attach (GTK_TABLE (table9), alignment26, 7, 8, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evCCB = gtk_event_box_new (); gtk_widget_set_name (evCCB, "evCCB"); gtk_widget_show (evCCB); gtk_container_add (GTK_CONTAINER (alignment26), evCCB); lblCCB = gtk_label_new ("B"); gtk_widget_set_name (lblCCB, "lblCCB"); gtk_widget_show (lblCCB); gtk_container_add (GTK_CONTAINER (evCCB), lblCCB); alignment27 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_widget_set_name (alignment27, "alignment27"); gtk_widget_show (alignment27); gtk_table_attach (GTK_TABLE (table9), alignment27, 8, 9, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); evCCA = gtk_event_box_new (); gtk_widget_set_name (evCCA, "evCCA"); gtk_widget_show (evCCA); gtk_container_add (GTK_CONTAINER (alignment27), evCCA); lblCCA = gtk_label_new ("A"); gtk_widget_set_name (lblCCA, "lblCCA"); gtk_widget_show (lblCCA); gtk_container_add (GTK_CONTAINER (evCCA), lblCCA); hbox15 = gtk_hbox_new (FALSE, 5); gtk_widget_set_name (hbox15, "hbox15"); gtk_widget_show (hbox15); gtk_box_pack_start (GTK_BOX (vbox5), hbox15, TRUE, TRUE, 0); drawCCLStick = gtk_drawing_area_new (); gtk_widget_set_name (drawCCLStick, "drawCCLStick"); gtk_widget_show (drawCCLStick); gtk_box_pack_start (GTK_BOX (hbox15), drawCCLStick, TRUE, TRUE, 0); gtk_widget_set_size_request (drawCCLStick, 50, 50); drawCCRStick = gtk_drawing_area_new (); gtk_widget_set_name (drawCCRStick, "drawCCRStick"); gtk_widget_show (drawCCRStick); gtk_box_pack_start (GTK_BOX (hbox15), drawCCRStick, TRUE, TRUE, 0); gtk_widget_set_size_request (drawCCRStick, 50, 50); table10 = gtk_table_new (2, 3, FALSE); gtk_widget_set_name (table10, "table10"); gtk_widget_show (table10); gtk_box_pack_start (GTK_BOX (hbox15), table10, TRUE, TRUE, 0); lblCCLVal = gtk_label_new ("0"); gtk_widget_set_name (lblCCLVal, "lblCCLVal"); gtk_widget_show (lblCCLVal); gtk_table_attach (GTK_TABLE (table10), lblCCLVal, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblCCLVal, 35, -1); gtk_misc_set_alignment (GTK_MISC (lblCCLVal), 0, 0.5); lblCCRVal = gtk_label_new ("0"); gtk_widget_set_name (lblCCRVal, "lblCCRVal"); gtk_widget_show (lblCCRVal); gtk_table_attach (GTK_TABLE (table10), lblCCRVal, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_size_request (lblCCRVal, 35, -1); gtk_misc_set_alignment (GTK_MISC (lblCCRVal), 0, 0.5); progCCL = gtk_progress_bar_new (); gtk_widget_set_name (progCCL, "progCCL"); gtk_widget_show (progCCL); gtk_table_attach (GTK_TABLE (table10), progCCL, 2, 3, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); progCCR = gtk_progress_bar_new (); gtk_widget_set_name (progCCR, "progCCR"); gtk_widget_show (progCCR); gtk_table_attach (GTK_TABLE (table10), progCCR, 2, 3, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); evCCR = gtk_event_box_new (); gtk_widget_set_name (evCCR, "evCCR"); gtk_widget_show (evCCR); gtk_table_attach (GTK_TABLE (table10), evCCR, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); lblCCR = gtk_label_new ("R:"); gtk_widget_set_name (lblCCR, "lblCCR"); gtk_widget_show (lblCCR); gtk_container_add (GTK_CONTAINER (evCCR), lblCCR); gtk_misc_set_alignment (GTK_MISC (lblCCR), 0, 0.5); evCCL = gtk_event_box_new (); gtk_widget_set_name (evCCL, "evCCL"); gtk_widget_show (evCCL); gtk_table_attach (GTK_TABLE (table10), evCCL, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); lblCCL = gtk_label_new ("L:"); gtk_widget_set_name (lblCCL, "lblCCL"); gtk_widget_show (lblCCL); gtk_container_add (GTK_CONTAINER (evCCL), lblCCL); gtk_misc_set_alignment (GTK_MISC (lblCCL), 0, 0.5); lblClassic = gtk_label_new ("Classic Controller"); gtk_widget_set_name (lblClassic, "lblClassic"); gtk_widget_show (lblClassic); gtk_frame_set_label_widget (GTK_FRAME (frame5), lblClassic); gtk_label_set_use_markup (GTK_LABEL (lblClassic), TRUE); hbox11 = gtk_hbox_new (TRUE, 0); gtk_widget_set_name (hbox11, "hbox11"); gtk_widget_show (hbox11); gtk_box_pack_start (GTK_BOX (vbox1), hbox11, FALSE, FALSE, 0); statConnection = gtk_statusbar_new (); gtk_widget_set_name (statConnection, "statConnection"); gtk_widget_show (statConnection); gtk_box_pack_start (GTK_BOX (hbox11), statConnection, TRUE, TRUE, 0); gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (statConnection), FALSE); statBattery = gtk_statusbar_new (); gtk_widget_set_name (statBattery, "statBattery"); gtk_widget_show (statBattery); gtk_box_pack_start (GTK_BOX (hbox11), statBattery, FALSE, TRUE, 0); gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (statBattery), FALSE); statExtension = gtk_statusbar_new (); gtk_widget_set_name (statExtension, "statExtension"); gtk_widget_show (statExtension); gtk_box_pack_start (GTK_BOX (hbox11), statExtension, FALSE, TRUE, 0); gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (statExtension), FALSE); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (winMain, winMain, "winMain"); GLADE_HOOKUP_OBJECT (winMain, vbox1, "vbox1"); GLADE_HOOKUP_OBJECT (winMain, menubar1, "menubar1"); GLADE_HOOKUP_OBJECT (winMain, menuitem1, "menuitem1"); GLADE_HOOKUP_OBJECT (winMain, menuitem1_menu, "menuitem1_menu"); GLADE_HOOKUP_OBJECT (winMain, menuConnect, "menuConnect"); GLADE_HOOKUP_OBJECT (winMain, image27, "image27"); GLADE_HOOKUP_OBJECT (winMain, menuDisconnect, "menuDisconnect"); GLADE_HOOKUP_OBJECT (winMain, image28, "image28"); GLADE_HOOKUP_OBJECT (winMain, separatormenuitem1, "separatormenuitem1"); GLADE_HOOKUP_OBJECT (winMain, menuQuit, "menuQuit"); GLADE_HOOKUP_OBJECT (winMain, image29, "image29"); GLADE_HOOKUP_OBJECT (winMain, menuSettings, "menuSettings"); GLADE_HOOKUP_OBJECT (winMain, menuSettings_menu, "menuSettings_menu"); GLADE_HOOKUP_OBJECT (winMain, chkAcc, "chkAcc"); GLADE_HOOKUP_OBJECT (winMain, chkIR, "chkIR"); GLADE_HOOKUP_OBJECT (winMain, chkExt, "chkExt"); GLADE_HOOKUP_OBJECT (winMain, menuControls, "menuControls"); GLADE_HOOKUP_OBJECT (winMain, menuControls_menu, "menuControls_menu"); GLADE_HOOKUP_OBJECT (winMain, chkLED1, "chkLED1"); GLADE_HOOKUP_OBJECT (winMain, chkLED2, "chkLED2"); GLADE_HOOKUP_OBJECT (winMain, chkLED3, "chkLED3"); GLADE_HOOKUP_OBJECT (winMain, chkLED4, "chkLED4"); GLADE_HOOKUP_OBJECT (winMain, separator1, "separator1"); GLADE_HOOKUP_OBJECT (winMain, chkRumble, "chkRumble"); GLADE_HOOKUP_OBJECT (winMain, menuView, "menuView"); GLADE_HOOKUP_OBJECT (winMain, menuView_menu, "menuView_menu"); GLADE_HOOKUP_OBJECT (winMain, menuRW, "menuRW"); GLADE_HOOKUP_OBJECT (winMain, menuHelp, "menuHelp"); GLADE_HOOKUP_OBJECT (winMain, menuHelp_menu, "menuHelp_menu"); GLADE_HOOKUP_OBJECT (winMain, menuAbout, "menuAbout"); GLADE_HOOKUP_OBJECT (winMain, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (winMain, frame1, "frame1"); GLADE_HOOKUP_OBJECT (winMain, alignment1, "alignment1"); GLADE_HOOKUP_OBJECT (winMain, table1, "table1"); GLADE_HOOKUP_OBJECT (winMain, alignment3, "alignment3"); GLADE_HOOKUP_OBJECT (winMain, evUp, "evUp"); GLADE_HOOKUP_OBJECT (winMain, lblUp, "lblUp"); GLADE_HOOKUP_OBJECT (winMain, alignment4, "alignment4"); GLADE_HOOKUP_OBJECT (winMain, evLeft, "evLeft"); GLADE_HOOKUP_OBJECT (winMain, lblLeft, "lblLeft"); GLADE_HOOKUP_OBJECT (winMain, alignment5, "alignment5"); GLADE_HOOKUP_OBJECT (winMain, evRight, "evRight"); GLADE_HOOKUP_OBJECT (winMain, lblRight, "lblRight"); GLADE_HOOKUP_OBJECT (winMain, alignment6, "alignment6"); GLADE_HOOKUP_OBJECT (winMain, evDown, "evDown"); GLADE_HOOKUP_OBJECT (winMain, lblDown, "lblDown"); GLADE_HOOKUP_OBJECT (winMain, alignment7, "alignment7"); GLADE_HOOKUP_OBJECT (winMain, evA, "evA"); GLADE_HOOKUP_OBJECT (winMain, lblA, "lblA"); GLADE_HOOKUP_OBJECT (winMain, alignment9, "alignment9"); GLADE_HOOKUP_OBJECT (winMain, evB, "evB"); GLADE_HOOKUP_OBJECT (winMain, lblB, "lblB"); GLADE_HOOKUP_OBJECT (winMain, alignment10, "alignment10"); GLADE_HOOKUP_OBJECT (winMain, evMinus, "evMinus"); GLADE_HOOKUP_OBJECT (winMain, lblMinus, "lblMinus"); GLADE_HOOKUP_OBJECT (winMain, alignment11, "alignment11"); GLADE_HOOKUP_OBJECT (winMain, evHome, "evHome"); GLADE_HOOKUP_OBJECT (winMain, lblHome, "lblHome"); GLADE_HOOKUP_OBJECT (winMain, alignment12, "alignment12"); GLADE_HOOKUP_OBJECT (winMain, evPlus, "evPlus"); GLADE_HOOKUP_OBJECT (winMain, lblPlus, "lblPlus"); GLADE_HOOKUP_OBJECT (winMain, alignment13, "alignment13"); GLADE_HOOKUP_OBJECT (winMain, ev1, "ev1"); GLADE_HOOKUP_OBJECT (winMain, lbl1, "lbl1"); GLADE_HOOKUP_OBJECT (winMain, alignment14, "alignment14"); GLADE_HOOKUP_OBJECT (winMain, ev2, "ev2"); GLADE_HOOKUP_OBJECT (winMain, lbl2, "lbl2"); GLADE_HOOKUP_OBJECT (winMain, label1, "label1"); GLADE_HOOKUP_OBJECT (winMain, frame2, "frame2"); GLADE_HOOKUP_OBJECT (winMain, alignment2, "alignment2"); GLADE_HOOKUP_OBJECT (winMain, hbox2, "hbox2"); GLADE_HOOKUP_OBJECT (winMain, table4, "table4"); GLADE_HOOKUP_OBJECT (winMain, progAccX, "progAccX"); GLADE_HOOKUP_OBJECT (winMain, progAccY, "progAccY"); GLADE_HOOKUP_OBJECT (winMain, progAccZ, "progAccZ"); GLADE_HOOKUP_OBJECT (winMain, lblAccX, "lblAccX"); GLADE_HOOKUP_OBJECT (winMain, lblAccXVal, "lblAccXVal"); GLADE_HOOKUP_OBJECT (winMain, lblAccY, "lblAccY"); GLADE_HOOKUP_OBJECT (winMain, lblAccYVal, "lblAccYVal"); GLADE_HOOKUP_OBJECT (winMain, lblAccZ, "lblAccZ"); GLADE_HOOKUP_OBJECT (winMain, lblAccZVal, "lblAccZVal"); GLADE_HOOKUP_OBJECT (winMain, lblPitch, "lblPitch"); GLADE_HOOKUP_OBJECT (winMain, lblPitchVal, "lblPitchVal"); GLADE_HOOKUP_OBJECT (winMain, lblRoll, "lblRoll"); GLADE_HOOKUP_OBJECT (winMain, lblRollVal, "lblRollVal"); GLADE_HOOKUP_OBJECT (winMain, lblAcc, "lblAcc"); GLADE_HOOKUP_OBJECT (winMain, lblAccVal, "lblAccVal"); GLADE_HOOKUP_OBJECT (winMain, btnBeep, "btnBeep"); GLADE_HOOKUP_OBJECT (winMain, frame3, "frame3"); GLADE_HOOKUP_OBJECT (winMain, drawIR, "drawIR"); GLADE_HOOKUP_OBJECT (winMain, lblIR, "lblIR"); GLADE_HOOKUP_OBJECT (winMain, label2, "label2"); GLADE_HOOKUP_OBJECT (winMain, hbox10, "hbox10"); GLADE_HOOKUP_OBJECT (winMain, frame4, "frame4"); GLADE_HOOKUP_OBJECT (winMain, alignment28, "alignment28"); GLADE_HOOKUP_OBJECT (winMain, hbox12, "hbox12"); GLADE_HOOKUP_OBJECT (winMain, vbox4, "vbox4"); GLADE_HOOKUP_OBJECT (winMain, drawNCStick, "drawNCStick"); GLADE_HOOKUP_OBJECT (winMain, hbox13, "hbox13"); GLADE_HOOKUP_OBJECT (winMain, evNCC, "evNCC"); GLADE_HOOKUP_OBJECT (winMain, lblNCC, "lblNCC"); GLADE_HOOKUP_OBJECT (winMain, evNCZ, "evNCZ"); GLADE_HOOKUP_OBJECT (winMain, lblNCZ, "lblNCZ"); GLADE_HOOKUP_OBJECT (winMain, table8, "table8"); GLADE_HOOKUP_OBJECT (winMain, lblNCAccX, "lblNCAccX"); GLADE_HOOKUP_OBJECT (winMain, lblNCAccY, "lblNCAccY"); GLADE_HOOKUP_OBJECT (winMain, lblNCAccZ, "lblNCAccZ"); GLADE_HOOKUP_OBJECT (winMain, lblNCAcc, "lblNCAcc"); GLADE_HOOKUP_OBJECT (winMain, lblNCRoll, "lblNCRoll"); GLADE_HOOKUP_OBJECT (winMain, lblNCPitch, "lblNCPitch"); GLADE_HOOKUP_OBJECT (winMain, lblNCAccXVal, "lblNCAccXVal"); GLADE_HOOKUP_OBJECT (winMain, lblNCAccYVal, "lblNCAccYVal"); GLADE_HOOKUP_OBJECT (winMain, lblNCAccZVal, "lblNCAccZVal"); GLADE_HOOKUP_OBJECT (winMain, lblNCAccVal, "lblNCAccVal"); GLADE_HOOKUP_OBJECT (winMain, lblNCRollVal, "lblNCRollVal"); GLADE_HOOKUP_OBJECT (winMain, lblNCPitchVal, "lblNCPitchVal"); GLADE_HOOKUP_OBJECT (winMain, progNCAccX, "progNCAccX"); GLADE_HOOKUP_OBJECT (winMain, progNCAccZ, "progNCAccZ"); GLADE_HOOKUP_OBJECT (winMain, progNCAccY, "progNCAccY"); GLADE_HOOKUP_OBJECT (winMain, lblNC, "lblNC"); GLADE_HOOKUP_OBJECT (winMain, frame5, "frame5"); GLADE_HOOKUP_OBJECT (winMain, alignment29, "alignment29"); GLADE_HOOKUP_OBJECT (winMain, vbox5, "vbox5"); GLADE_HOOKUP_OBJECT (winMain, table9, "table9"); GLADE_HOOKUP_OBJECT (winMain, alignment15, "alignment15"); GLADE_HOOKUP_OBJECT (winMain, evCCLeft, "evCCLeft"); GLADE_HOOKUP_OBJECT (winMain, lblCCLeft, "lblCCLeft"); GLADE_HOOKUP_OBJECT (winMain, alignment16, "alignment16"); GLADE_HOOKUP_OBJECT (winMain, evCCUp, "evCCUp"); GLADE_HOOKUP_OBJECT (winMain, lblCCUp, "lblCCUp"); GLADE_HOOKUP_OBJECT (winMain, alignment17, "alignment17"); GLADE_HOOKUP_OBJECT (winMain, evCCDown, "evCCDown"); GLADE_HOOKUP_OBJECT (winMain, lblCCDown, "lblCCDown"); GLADE_HOOKUP_OBJECT (winMain, alignment18, "alignment18"); GLADE_HOOKUP_OBJECT (winMain, evCCRight, "evCCRight"); GLADE_HOOKUP_OBJECT (winMain, lblCCRight, "lblCCRight"); GLADE_HOOKUP_OBJECT (winMain, alignment19, "alignment19"); GLADE_HOOKUP_OBJECT (winMain, evCCMinus, "evCCMinus"); GLADE_HOOKUP_OBJECT (winMain, lblCCMinus, "lblCCMinus"); GLADE_HOOKUP_OBJECT (winMain, alignment20, "alignment20"); GLADE_HOOKUP_OBJECT (winMain, evCCHome, "evCCHome"); GLADE_HOOKUP_OBJECT (winMain, lblCCHome, "lblCCHome"); GLADE_HOOKUP_OBJECT (winMain, alignment21, "alignment21"); GLADE_HOOKUP_OBJECT (winMain, evCCPlus, "evCCPlus"); GLADE_HOOKUP_OBJECT (winMain, lblCCPlus, "lblCCPlus"); GLADE_HOOKUP_OBJECT (winMain, alignment22, "alignment22"); GLADE_HOOKUP_OBJECT (winMain, evCCZL, "evCCZL"); GLADE_HOOKUP_OBJECT (winMain, lblCCZL, "lblCCZL"); GLADE_HOOKUP_OBJECT (winMain, alignment23, "alignment23"); GLADE_HOOKUP_OBJECT (winMain, evCCZR, "evCCZR"); GLADE_HOOKUP_OBJECT (winMain, lblCCZR, "lblCCZR"); GLADE_HOOKUP_OBJECT (winMain, alignment24, "alignment24"); GLADE_HOOKUP_OBJECT (winMain, evCCX, "evCCX"); GLADE_HOOKUP_OBJECT (winMain, lblCCX, "lblCCX"); GLADE_HOOKUP_OBJECT (winMain, alignment25, "alignment25"); GLADE_HOOKUP_OBJECT (winMain, evCCY, "evCCY"); GLADE_HOOKUP_OBJECT (winMain, lblCCY, "lblCCY"); GLADE_HOOKUP_OBJECT (winMain, alignment26, "alignment26"); GLADE_HOOKUP_OBJECT (winMain, evCCB, "evCCB"); GLADE_HOOKUP_OBJECT (winMain, lblCCB, "lblCCB"); GLADE_HOOKUP_OBJECT (winMain, alignment27, "alignment27"); GLADE_HOOKUP_OBJECT (winMain, evCCA, "evCCA"); GLADE_HOOKUP_OBJECT (winMain, lblCCA, "lblCCA"); GLADE_HOOKUP_OBJECT (winMain, hbox15, "hbox15"); GLADE_HOOKUP_OBJECT (winMain, drawCCLStick, "drawCCLStick"); GLADE_HOOKUP_OBJECT (winMain, drawCCRStick, "drawCCRStick"); GLADE_HOOKUP_OBJECT (winMain, table10, "table10"); GLADE_HOOKUP_OBJECT (winMain, lblCCLVal, "lblCCLVal"); GLADE_HOOKUP_OBJECT (winMain, lblCCRVal, "lblCCRVal"); GLADE_HOOKUP_OBJECT (winMain, progCCL, "progCCL"); GLADE_HOOKUP_OBJECT (winMain, progCCR, "progCCR"); GLADE_HOOKUP_OBJECT (winMain, evCCR, "evCCR"); GLADE_HOOKUP_OBJECT (winMain, lblCCR, "lblCCR"); GLADE_HOOKUP_OBJECT (winMain, evCCL, "evCCL"); GLADE_HOOKUP_OBJECT (winMain, lblCCL, "lblCCL"); GLADE_HOOKUP_OBJECT (winMain, lblClassic, "lblClassic"); GLADE_HOOKUP_OBJECT (winMain, hbox11, "hbox11"); GLADE_HOOKUP_OBJECT (winMain, statConnection, "statConnection"); GLADE_HOOKUP_OBJECT (winMain, statBattery, "statBattery"); GLADE_HOOKUP_OBJECT (winMain, statExtension, "statExtension"); gtk_window_add_accel_group (GTK_WINDOW (winMain), accel_group); return winMain; } GtkWidget* create_winRW (void) { GtkWidget *winRW; GtkWidget *vbox3; GtkWidget *label25; GtkWidget *hbox3; GtkWidget *table6; GtkWidget *label29; GtkWidget *label30; GtkWidget *txtReadOffset; GtkWidget *txtReadLen; GtkWidget *radReadEEPROM; GSList *radReadEEPROM_group = NULL; GtkWidget *radReadReg; GtkWidget *hbox7; GtkWidget *btnRead; GtkWidget *hbox4; GtkWidget *label31; GtkWidget *table7; GtkWidget *label33; GtkWidget *label34; GtkWidget *txtWriteOffset; GtkWidget *txtWriteData; GtkWidget *radWriteEEPROM; GSList *radWriteEEPROM_group = NULL; GtkWidget *radWriteReg; GtkWidget *hbox8; GtkWidget *btnWrite; GtkWidget *hbox6; GtkWidget *label32; GtkWidget *scrolledwindow1; GtkWidget *tvRW; GtkWidget *hbox9; GtkWidget *btnRWClose; winRW = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_name (winRW, "winRW"); gtk_window_set_title (GTK_WINDOW (winRW), "Memory Read/Write"); vbox3 = gtk_vbox_new (FALSE, 4); gtk_widget_set_name (vbox3, "vbox3"); gtk_widget_show (vbox3); gtk_container_add (GTK_CONTAINER (winRW), vbox3); gtk_container_set_border_width (GTK_CONTAINER (vbox3), 5); label25 = gtk_label_new ("Note: all values are in hex"); gtk_widget_set_name (label25, "label25"); gtk_widget_show (label25); gtk_box_pack_start (GTK_BOX (vbox3), label25, FALSE, FALSE, 0); hbox3 = gtk_hbox_new (FALSE, 5); gtk_widget_set_name (hbox3, "hbox3"); gtk_widget_show (hbox3); gtk_box_pack_start (GTK_BOX (vbox3), hbox3, FALSE, TRUE, 0); table6 = gtk_table_new (6, 2, FALSE); gtk_widget_set_name (table6, "table6"); gtk_widget_show (table6); gtk_box_pack_start (GTK_BOX (hbox3), table6, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table6), 2); label29 = gtk_label_new ("Offset:"); gtk_widget_set_name (label29, "label29"); gtk_widget_show (label29); gtk_table_attach (GTK_TABLE (table6), label29, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label29), 0, 0.5); label30 = gtk_label_new ("Length:"); gtk_widget_set_name (label30, "label30"); gtk_widget_show (label30); gtk_table_attach (GTK_TABLE (table6), label30, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label30), 0, 0.5); txtReadOffset = gtk_entry_new (); gtk_widget_set_name (txtReadOffset, "txtReadOffset"); gtk_widget_show (txtReadOffset); gtk_table_attach (GTK_TABLE (table6), txtReadOffset, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); txtReadLen = gtk_entry_new (); gtk_widget_set_name (txtReadLen, "txtReadLen"); gtk_widget_show (txtReadLen); gtk_table_attach (GTK_TABLE (table6), txtReadLen, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); radReadEEPROM = gtk_radio_button_new_with_mnemonic (NULL, "EEPROM"); gtk_widget_set_name (radReadEEPROM, "radReadEEPROM"); gtk_widget_show (radReadEEPROM); gtk_table_attach (GTK_TABLE (table6), radReadEEPROM, 0, 2, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (radReadEEPROM), radReadEEPROM_group); radReadEEPROM_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radReadEEPROM)); radReadReg = gtk_radio_button_new_with_mnemonic (NULL, "Register"); gtk_widget_set_name (radReadReg, "radReadReg"); gtk_widget_show (radReadReg); gtk_table_attach (GTK_TABLE (table6), radReadReg, 0, 2, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (radReadReg), radReadEEPROM_group); radReadEEPROM_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radReadReg)); hbox7 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox7, "hbox7"); gtk_widget_show (hbox7); gtk_table_attach (GTK_TABLE (table6), hbox7, 0, 2, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); btnRead = gtk_button_new_with_mnemonic ("Read"); gtk_widget_set_name (btnRead, "btnRead"); gtk_widget_show (btnRead); gtk_box_pack_start (GTK_BOX (hbox7), btnRead, TRUE, FALSE, 0); hbox4 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox4, "hbox4"); gtk_widget_show (hbox4); gtk_table_attach (GTK_TABLE (table6), hbox4, 0, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); label31 = gtk_label_new ("Read"); gtk_widget_set_name (label31, "label31"); gtk_widget_show (label31); gtk_box_pack_start (GTK_BOX (hbox4), label31, TRUE, FALSE, 0); table7 = gtk_table_new (6, 2, FALSE); gtk_widget_set_name (table7, "table7"); gtk_widget_show (table7); gtk_box_pack_start (GTK_BOX (hbox3), table7, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table7), 2); label33 = gtk_label_new ("Offset:"); gtk_widget_set_name (label33, "label33"); gtk_widget_show (label33); gtk_table_attach (GTK_TABLE (table7), label33, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label33), 0, 0.5); label34 = gtk_label_new ("Data:"); gtk_widget_set_name (label34, "label34"); gtk_widget_show (label34); gtk_table_attach (GTK_TABLE (table7), label34, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label34), 0, 0.5); txtWriteOffset = gtk_entry_new (); gtk_widget_set_name (txtWriteOffset, "txtWriteOffset"); gtk_widget_show (txtWriteOffset); gtk_table_attach (GTK_TABLE (table7), txtWriteOffset, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); txtWriteData = gtk_entry_new (); gtk_widget_set_name (txtWriteData, "txtWriteData"); gtk_widget_show (txtWriteData); gtk_table_attach (GTK_TABLE (table7), txtWriteData, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); radWriteEEPROM = gtk_radio_button_new_with_mnemonic (NULL, "EEPROM"); gtk_widget_set_name (radWriteEEPROM, "radWriteEEPROM"); gtk_widget_show (radWriteEEPROM); gtk_table_attach (GTK_TABLE (table7), radWriteEEPROM, 0, 2, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (radWriteEEPROM), radWriteEEPROM_group); radWriteEEPROM_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radWriteEEPROM)); radWriteReg = gtk_radio_button_new_with_mnemonic (NULL, "Register"); gtk_widget_set_name (radWriteReg, "radWriteReg"); gtk_widget_show (radWriteReg); gtk_table_attach (GTK_TABLE (table7), radWriteReg, 0, 2, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_radio_button_set_group (GTK_RADIO_BUTTON (radWriteReg), radWriteEEPROM_group); radWriteEEPROM_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radWriteReg)); hbox8 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox8, "hbox8"); gtk_widget_show (hbox8); gtk_table_attach (GTK_TABLE (table7), hbox8, 0, 2, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); btnWrite = gtk_button_new_with_mnemonic ("Write"); gtk_widget_set_name (btnWrite, "btnWrite"); gtk_widget_show (btnWrite); gtk_box_pack_start (GTK_BOX (hbox8), btnWrite, TRUE, FALSE, 0); hbox6 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox6, "hbox6"); gtk_widget_show (hbox6); gtk_table_attach (GTK_TABLE (table7), hbox6, 0, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); label32 = gtk_label_new ("Write"); gtk_widget_set_name (label32, "label32"); gtk_widget_show (label32); gtk_box_pack_start (GTK_BOX (hbox6), label32, TRUE, FALSE, 0); scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_name (scrolledwindow1, "scrolledwindow1"); gtk_widget_show (scrolledwindow1); gtk_box_pack_start (GTK_BOX (vbox3), scrolledwindow1, TRUE, TRUE, 0); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN); tvRW = gtk_text_view_new (); gtk_widget_set_name (tvRW, "tvRW"); gtk_widget_show (tvRW); gtk_container_add (GTK_CONTAINER (scrolledwindow1), tvRW); hbox9 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox9, "hbox9"); gtk_widget_show (hbox9); gtk_box_pack_start (GTK_BOX (vbox3), hbox9, FALSE, TRUE, 0); btnRWClose = gtk_button_new_with_mnemonic ("Close"); gtk_widget_set_name (btnRWClose, "btnRWClose"); gtk_widget_show (btnRWClose); gtk_box_pack_start (GTK_BOX (hbox9), btnRWClose, TRUE, FALSE, 0); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (winRW, winRW, "winRW"); GLADE_HOOKUP_OBJECT (winRW, vbox3, "vbox3"); GLADE_HOOKUP_OBJECT (winRW, label25, "label25"); GLADE_HOOKUP_OBJECT (winRW, hbox3, "hbox3"); GLADE_HOOKUP_OBJECT (winRW, table6, "table6"); GLADE_HOOKUP_OBJECT (winRW, label29, "label29"); GLADE_HOOKUP_OBJECT (winRW, label30, "label30"); GLADE_HOOKUP_OBJECT (winRW, txtReadOffset, "txtReadOffset"); GLADE_HOOKUP_OBJECT (winRW, txtReadLen, "txtReadLen"); GLADE_HOOKUP_OBJECT (winRW, radReadEEPROM, "radReadEEPROM"); GLADE_HOOKUP_OBJECT (winRW, radReadReg, "radReadReg"); GLADE_HOOKUP_OBJECT (winRW, hbox7, "hbox7"); GLADE_HOOKUP_OBJECT (winRW, btnRead, "btnRead"); GLADE_HOOKUP_OBJECT (winRW, hbox4, "hbox4"); GLADE_HOOKUP_OBJECT (winRW, label31, "label31"); GLADE_HOOKUP_OBJECT (winRW, table7, "table7"); GLADE_HOOKUP_OBJECT (winRW, label33, "label33"); GLADE_HOOKUP_OBJECT (winRW, label34, "label34"); GLADE_HOOKUP_OBJECT (winRW, txtWriteOffset, "txtWriteOffset"); GLADE_HOOKUP_OBJECT (winRW, txtWriteData, "txtWriteData"); GLADE_HOOKUP_OBJECT (winRW, radWriteEEPROM, "radWriteEEPROM"); GLADE_HOOKUP_OBJECT (winRW, radWriteReg, "radWriteReg"); GLADE_HOOKUP_OBJECT (winRW, hbox8, "hbox8"); GLADE_HOOKUP_OBJECT (winRW, btnWrite, "btnWrite"); GLADE_HOOKUP_OBJECT (winRW, hbox6, "hbox6"); GLADE_HOOKUP_OBJECT (winRW, label32, "label32"); GLADE_HOOKUP_OBJECT (winRW, scrolledwindow1, "scrolledwindow1"); GLADE_HOOKUP_OBJECT (winRW, tvRW, "tvRW"); GLADE_HOOKUP_OBJECT (winRW, hbox9, "hbox9"); GLADE_HOOKUP_OBJECT (winRW, btnRWClose, "btnRWClose"); return winRW; } cwiid-0.6.00+svn201/wmgui/interface.h0000644000175000017500000000017710567071413016275 0ustar tootstoots/* * DO NOT EDIT THIS FILE - it is generated by Glade. */ GtkWidget* create_winMain (void); GtkWidget* create_winRW (void); cwiid-0.6.00+svn201/wmgui/wmgui.glade0000644000175000017500000037004610567071413016317 0ustar tootstoots True wmgui GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False True False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True False 3 True True _File True True _Connect True True gtk-connect 1 0.5 0.5 0 0 True _Disconnect True True gtk-disconnect 1 0.5 0.5 0 0 True True _Quit True True gtk-quit 1 0.5 0.5 0 0 True _Settings True True _Acc Data True False True _IR Data True False True _Extension Data True False True _Controls True True LED _1 True False True LED _2 True False True LED _3 True False True LED _4 True False True True _Rumble True False True _View True True _Memory Read/Write True True _Help True True _About True 0 False False True False 0 True 0 0.5 GTK_SHADOW_ETCHED_IN True 0.5 0.5 1 1 0 0 12 0 True 6 3 True 0 0 True 0.5 0.5 1 1 0 0 0 0 True True False True Up False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 1 2 0 1 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Left False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 1 1 2 True 0.5 0.5 1 1 0 0 0 0 True True False True Right False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 2 3 1 2 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Down False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 1 2 2 3 fill True 0.5 0.5 1 1 0 0 0 0 True True False True A False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 1 3 4 fill True 0.5 0.5 1 1 0 0 0 0 True True False True B False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 2 3 3 4 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True - False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 1 4 5 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Home False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 1 2 4 5 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True + False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 2 3 4 5 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True 1 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 1 5 6 fill True 0.5 0.5 1 1 0 0 0 0 True True False True 2 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 2 3 5 6 fill fill True <b>Buttons</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 3 True True True 0 0.5 GTK_SHADOW_ETCHED_IN True 0.5 0.5 1 1 0 0 12 0 True True 6 True 6 3 False 3 0 True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 0 1 fill True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 1 2 fill True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 2 3 fill True False X: False False GTK_JUSTIFY_RIGHT False False 0 0.5 0 0 0 1 0 1 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 0 1 fill True False Y: False False GTK_JUSTIFY_RIGHT False False 0 0.5 0 0 0 1 1 2 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 1 2 fill True False Z: False False GTK_JUSTIFY_RIGHT False False 0 0.5 0 0 0 1 2 3 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 2 3 fill True False Pitch: False False GTK_JUSTIFY_RIGHT False False 0 0.5 0 0 0 1 5 6 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 5 6 fill True False Roll: False False GTK_JUSTIFY_RIGHT False False 0 0.5 0 0 0 1 4 5 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 4 5 fill True False Acc: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 3 4 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 3 4 fill True Beep True GTK_RELIEF_NORMAL True 2 3 4 5 0 True True 4 True 0 0.5 GTK_SHADOW_IN True True False IR False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 0 True True True <b>Motion Sensors</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 3 True True 0 True True True False 0 True 0 0.5 GTK_SHADOW_ETCHED_IN True 0.5 0.5 1 1 0 0 12 0 True False 4 True False 0 50 50 True 0 True False True False 0 True True False True C False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True True True True False True Z False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True True 0 True False 0 True True True 6 3 False 3 0 True False X: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 0 1 fill True False Y: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 1 2 fill True False Z: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 2 3 fill True False Acc: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 3 4 fill True False Roll: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 4 5 fill True False Pitch: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 5 6 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 0 1 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 1 2 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 2 3 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 3 4 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 4 5 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 5 6 fill True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 0 1 fill True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 2 3 fill True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 1 2 fill 0 False True True <b>Nunchuk</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 3 True True True 0 0.5 GTK_SHADOW_ETCHED_IN True 0.5 0.5 1 1 0 0 12 0 True False 5 True 3 9 True 0 0 True 0.5 0.5 1 1 0 0 0 0 True True False True Left False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 1 1 2 True 0.5 0.5 1 1 0 0 0 0 True True False True Up False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 1 2 0 1 True 0.5 0.5 1 1 0 0 0 0 True True False True Down False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 1 2 2 3 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Right False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 2 3 1 2 fill True 0.5 0.5 1 1 0 0 0 0 True True False True - False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 3 4 2 3 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Home False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 4 5 2 3 fill True 0.5 0.5 1 1 0 0 0 0 True True False True + False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 5 6 2 3 fill True 0.5 0.5 1 1 0 0 0 0 True True False True ZL False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 3 4 0 1 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True ZR False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 5 6 0 1 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True X False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 7 8 0 1 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Y False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 6 7 1 2 fill True 0.5 0.5 1 1 0 0 0 0 True True False True B False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 7 8 2 3 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True A False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 8 9 1 2 fill 0 True True True False 5 50 50 True 0 True True 50 50 True 0 True True True 2 3 False 0 0 35 True 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 0 1 fill 35 True 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 1 2 fill True GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 0 1 fill True GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 1 2 fill True True False True R: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 1 2 fill fill True True False True L: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 0 1 fill fill 0 True True 0 True True True <b>Classic Controller</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 3 True True 0 False False True True 0 True False 0 True True True False 0 False True True False 0 False True 0 False False True Memory Read/Write GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False True False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST 5 True False 4 True Note: all values are in hex False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 False False True False 5 True 6 2 False 2 0 True Offset: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 1 2 fill True Length: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 2 3 fill True True True True 0 True * False 1 2 1 2 True True True True 0 True * False 1 2 2 3 True True EEPROM True GTK_RELIEF_NORMAL True False False True 0 2 3 4 fill True True Register True GTK_RELIEF_NORMAL True False False True radReadEEPROM 0 2 4 5 fill True False 0 True True Read True GTK_RELIEF_NORMAL True 0 True False 0 2 5 6 fill fill True False 0 True Read False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False 0 2 0 1 fill fill 0 True True True 6 2 False 2 0 True Offset: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 1 2 fill True Data: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 2 3 fill True True True True 0 True * False 1 2 1 2 True True True True 0 True * False 1 2 2 3 True True EEPROM True GTK_RELIEF_NORMAL True False False True 0 2 3 4 fill True True Register True GTK_RELIEF_NORMAL True False False True radWriteEEPROM 0 2 4 5 fill True False 0 True True Write True GTK_RELIEF_NORMAL True 0 True False 0 2 5 6 fill fill True False 0 True Write False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False 0 2 0 1 fill 0 True True 0 False True True True GTK_POLICY_ALWAYS GTK_POLICY_ALWAYS GTK_SHADOW_IN GTK_CORNER_TOP_LEFT True True True False True GTK_JUSTIFY_LEFT GTK_WRAP_NONE True 0 0 0 0 0 0 0 True True True False 0 True True Close True GTK_RELIEF_NORMAL True 0 True False 0 False True cwiid-0.6.00+svn201/wmgui/wmgui.glade.bak0000644000175000017500000037004610567071413017053 0ustar tootstoots True wmgui GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False True False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True False 3 True True _File True True _Connect True True gtk-connect 1 0.5 0.5 0 0 True _Disconnect True True gtk-disconnect 1 0.5 0.5 0 0 True True _Quit True True gtk-quit 1 0.5 0.5 0 0 True _Settings True True _Acc Data True False True _IR Data True False True _Extension Data True False True _Controls True True LED _1 True False True LED _2 True False True LED _3 True False True LED _4 True False True True _Rumble True False True _View True True _Memory Read/Write True True _Help True True _About True 0 False False True False 0 True 0 0.5 GTK_SHADOW_ETCHED_IN True 0.5 0.5 1 1 0 0 12 0 True 6 3 True 0 0 True 0.5 0.5 1 1 0 0 0 0 True True False True Up False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 1 2 0 1 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Left False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 1 1 2 True 0.5 0.5 1 1 0 0 0 0 True True False True Right False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 2 3 1 2 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Down False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 1 2 2 3 fill True 0.5 0.5 1 1 0 0 0 0 True True False True A False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 1 3 4 fill True 0.5 0.5 1 1 0 0 0 0 True True False True B False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 2 3 3 4 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True - False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 1 4 5 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Home False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 1 2 4 5 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True + False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 2 3 4 5 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True 1 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 1 5 6 fill True 0.5 0.5 1 1 0 0 0 0 True True False True 2 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 2 3 5 6 fill fill True <b>Buttons</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 3 True True True 0 0.5 GTK_SHADOW_ETCHED_IN True 0.5 0.5 1 1 0 0 12 0 True True 6 True 6 3 False 3 0 True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 0 1 fill True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 1 2 fill True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 2 3 fill True False X: False False GTK_JUSTIFY_RIGHT False False 0 0.5 0 0 0 1 0 1 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 0 1 fill True False Y: False False GTK_JUSTIFY_RIGHT False False 0 0.5 0 0 0 1 1 2 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 1 2 fill True False Z: False False GTK_JUSTIFY_RIGHT False False 0 0.5 0 0 0 1 2 3 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 2 3 fill True False Pitch: False False GTK_JUSTIFY_RIGHT False False 0 0.5 0 0 0 1 5 6 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 5 6 fill True False Roll: False False GTK_JUSTIFY_RIGHT False False 0 0.5 0 0 0 1 4 5 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 4 5 fill True False Acc: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 3 4 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 3 4 fill True Beep True GTK_RELIEF_NORMAL True 2 3 4 5 0 True True 4 True 0 0.5 GTK_SHADOW_IN True True False IR False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 0 True True True <b>Motion Sensors</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 3 True True 0 True True True False 0 True 0 0.5 GTK_SHADOW_ETCHED_IN True 0.5 0.5 1 1 0 0 12 0 True False 4 True False 0 50 50 True 0 True False True False 0 True True False True C False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True True True True False True Z False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True True 0 True False 0 True True True 6 3 False 3 0 True False X: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 0 1 fill True False Y: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 1 2 fill True False Z: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 2 3 fill True False Acc: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 3 4 fill True False Roll: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 4 5 fill True False Pitch: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 5 6 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 0 1 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 1 2 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 2 3 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 3 4 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 4 5 fill 35 True False 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 5 6 fill True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 0 1 fill True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 2 3 fill True False GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 1 2 fill 0 False True True <b>Nunchuk</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 3 True True True 0 0.5 GTK_SHADOW_ETCHED_IN True 0.5 0.5 1 1 0 0 12 0 True False 5 True 3 9 True 0 0 True 0.5 0.5 1 1 0 0 0 0 True True False True Left False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 1 1 2 True 0.5 0.5 1 1 0 0 0 0 True True False True Up False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 1 2 0 1 True 0.5 0.5 1 1 0 0 0 0 True True False True Down False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 1 2 2 3 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Right False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 2 3 1 2 fill True 0.5 0.5 1 1 0 0 0 0 True True False True - False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 3 4 2 3 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Home False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 4 5 2 3 fill True 0.5 0.5 1 1 0 0 0 0 True True False True + False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 5 6 2 3 fill True 0.5 0.5 1 1 0 0 0 0 True True False True ZL False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 3 4 0 1 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True ZR False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 5 6 0 1 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True X False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 7 8 0 1 fill True 0.5 0.5 1 1 0 0 0 0 True True False True Y False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 6 7 1 2 fill True 0.5 0.5 1 1 0 0 0 0 True True False True B False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 7 8 2 3 fill fill True 0.5 0.5 1 1 0 0 0 0 True True False True A False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 8 9 1 2 fill 0 True True True False 5 50 50 True 0 True True 50 50 True 0 True True True 2 3 False 0 0 35 True 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 0 1 fill 35 True 0 False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 1 2 1 2 fill True GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 0 1 fill True GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 2 3 1 2 fill True True False True R: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 1 2 fill fill True True False True L: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 0 1 fill fill 0 True True 0 True True True <b>Classic Controller</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 3 True True 0 False False True True 0 True False 0 True True True False 0 False True True False 0 False True 0 False False True Memory Read/Write GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False True False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST 5 True False 4 True Note: all values are in hex False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 False False True False 5 True 6 2 False 2 0 True Offset: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 1 2 fill True Length: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 2 3 fill True True True True 0 True * False 1 2 1 2 True True True True 0 True * False 1 2 2 3 True True EEPROM True GTK_RELIEF_NORMAL True False False True 0 2 3 4 fill True True Register True GTK_RELIEF_NORMAL True False False True radReadEEPROM 0 2 4 5 fill True False 0 True True Read True GTK_RELIEF_NORMAL True 0 True False 0 2 5 6 fill fill True False 0 True Read False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False 0 2 0 1 fill fill 0 True True True 6 2 False 2 0 True Offset: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 1 2 fill True Data: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 2 3 fill True True True True 0 True * False 1 2 1 2 True True True True 0 True * False 1 2 2 3 True True EEPROM True GTK_RELIEF_NORMAL True False False True 0 2 3 4 fill True True Register True GTK_RELIEF_NORMAL True False False True radWriteEEPROM 0 2 4 5 fill True False 0 True True Write True GTK_RELIEF_NORMAL True 0 True False 0 2 5 6 fill fill True False 0 True Write False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False 0 2 0 1 fill 0 True True 0 False True True True GTK_POLICY_ALWAYS GTK_POLICY_ALWAYS GTK_SHADOW_IN GTK_CORNER_TOP_LEFT True True True False True GTK_JUSTIFY_LEFT GTK_WRAP_NONE True 0 0 0 0 0 0 0 True True True False 0 True True Close True GTK_RELIEF_NORMAL True 0 True False 0 False True cwiid-0.6.00+svn201/wmgui/callbacks.c0000644000175000017500000000333610567071413016247 0ustar tootstoots#ifdef HAVE_CONFIG_H # include #endif #include #include "callbacks.h" #include "interface.h" #include "support.h" void on_new1_activate (GtkMenuItem *menuitem, gpointer user_data) { } void on_open1_activate (GtkMenuItem *menuitem, gpointer user_data) { } void on_save1_activate (GtkMenuItem *menuitem, gpointer user_data) { } void on_save_as1_activate (GtkMenuItem *menuitem, gpointer user_data) { } void on_quit1_activate (GtkMenuItem *menuitem, gpointer user_data) { } void on_cut1_activate (GtkMenuItem *menuitem, gpointer user_data) { } void on_copy1_activate (GtkMenuItem *menuitem, gpointer user_data) { } void on_paste1_activate (GtkMenuItem *menuitem, gpointer user_data) { } void on_delete1_activate (GtkMenuItem *menuitem, gpointer user_data) { } void on_about1_activate (GtkMenuItem *menuitem, gpointer user_data) { } void on_menuSettings_activate (GtkMenuItem *menuitem, gpointer user_data) { } cwiid-0.6.00+svn201/wmgui/callbacks.h0000644000175000017500000000306010567071413016246 0ustar tootstoots#include void on_new1_activate (GtkMenuItem *menuitem, gpointer user_data); void on_open1_activate (GtkMenuItem *menuitem, gpointer user_data); void on_save1_activate (GtkMenuItem *menuitem, gpointer user_data); void on_save_as1_activate (GtkMenuItem *menuitem, gpointer user_data); void on_quit1_activate (GtkMenuItem *menuitem, gpointer user_data); void on_cut1_activate (GtkMenuItem *menuitem, gpointer user_data); void on_copy1_activate (GtkMenuItem *menuitem, gpointer user_data); void on_paste1_activate (GtkMenuItem *menuitem, gpointer user_data); void on_delete1_activate (GtkMenuItem *menuitem, gpointer user_data); void on_about1_activate (GtkMenuItem *menuitem, gpointer user_data); void on_menuSettings_activate (GtkMenuItem *menuitem, gpointer user_data); cwiid-0.6.00+svn201/wmgui/Makefile.in0000644000175000017500000000054010652707447016233 0ustar tootstoots#Copyright (C) 2007 L. Donnie Smith include @top_builddir@/defs.mak APP_NAME = wmgui SOURCES = main.c interface.c support.c CFLAGS += @GTK_CFLAGS@ -I@top_builddir@/libcwiid LDFLAGS += -L@top_builddir@/libcwiid LDLIBS += @GTK_LIBS@ -lm -lcwiid INST_DIR = @bindir@ include $(COMMON)/include/app.mak distclean: clean rm Makefile .PHONY: distclean cwiid-0.6.00+svn201/wmgui/support.c0000644000175000017500000000712110567071413016040 0ustar tootstoots/* * DO NOT EDIT THIS FILE - it is generated by Glade. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include #include "support.h" GtkWidget* lookup_widget (GtkWidget *widget, const gchar *widget_name) { GtkWidget *parent, *found_widget; for (;;) { if (GTK_IS_MENU (widget)) parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); else parent = widget->parent; if (!parent) parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); if (parent == NULL) break; widget = parent; } found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), widget_name); if (!found_widget) g_warning ("Widget not found: %s", widget_name); return found_widget; } static GList *pixmaps_directories = NULL; /* Use this function to set the directory containing installed pixmaps. */ void add_pixmap_directory (const gchar *directory) { pixmaps_directories = g_list_prepend (pixmaps_directories, g_strdup (directory)); } /* This is an internally used function to find pixmap files. */ static gchar* find_pixmap_file (const gchar *filename) { GList *elem; /* We step through each of the pixmaps directory to find it. */ elem = pixmaps_directories; while (elem) { gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data, G_DIR_SEPARATOR_S, filename); if (g_file_test (pathname, G_FILE_TEST_EXISTS)) return pathname; g_free (pathname); elem = elem->next; } return NULL; } /* This is an internally used function to create pixmaps. */ GtkWidget* create_pixmap (GtkWidget *widget, const gchar *filename) { gchar *pathname = NULL; GtkWidget *pixmap; if (!filename || !filename[0]) return gtk_image_new (); pathname = find_pixmap_file (filename); if (!pathname) { g_warning ("Couldn't find pixmap file: %s", filename); return gtk_image_new (); } pixmap = gtk_image_new_from_file (pathname); g_free (pathname); return pixmap; } /* This is an internally used function to create pixmaps. */ GdkPixbuf* create_pixbuf (const gchar *filename) { gchar *pathname = NULL; GdkPixbuf *pixbuf; GError *error = NULL; if (!filename || !filename[0]) return NULL; pathname = find_pixmap_file (filename); if (!pathname) { g_warning ("Couldn't find pixmap file: %s", filename); return NULL; } pixbuf = gdk_pixbuf_new_from_file (pathname, &error); if (!pixbuf) { fprintf (stderr, "Failed to load pixbuf file: %s: %s\n", pathname, error->message); g_error_free (error); } g_free (pathname); return pixbuf; } /* This is used to set ATK action descriptions. */ void glade_set_atk_action_description (AtkAction *action, const gchar *action_name, const gchar *description) { gint n_actions, i; n_actions = atk_action_get_n_actions (action); for (i = 0; i < n_actions; i++) { if (!strcmp (atk_action_get_name (action, i), action_name)) atk_action_set_description (action, i, description); } } cwiid-0.6.00+svn201/wmgui/support.h0000644000175000017500000000246510567071413016053 0ustar tootstoots/* * DO NOT EDIT THIS FILE - it is generated by Glade. */ #ifdef HAVE_CONFIG_H # include #endif #include /* * Public Functions. */ /* * This function returns a widget in a component created by Glade. * Call it with the toplevel widget in the component (i.e. a window/dialog), * or alternatively any widget in the component, and the name of the widget * you want returned. */ GtkWidget* lookup_widget (GtkWidget *widget, const gchar *widget_name); /* Use this function to set the directory containing installed pixmaps. */ void add_pixmap_directory (const gchar *directory); /* * Private Functions. */ /* This is used to create the pixmaps used in the interface. */ GtkWidget* create_pixmap (GtkWidget *widget, const gchar *filename); /* This is used to create the pixbufs used in the interface. */ GdkPixbuf* create_pixbuf (const gchar *filename); /* This is used to set ATK action descriptions. */ void glade_set_atk_action_description (AtkAction *action, const gchar *action_name, const gchar *description); cwiid-0.6.00+svn201/wmgui/main.c0000644000175000017500000012131411223453733015250 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2007-07-28 L. Donnie Smith * * added config.h include * * use PACKAGE_VERSION from config.h instead of CWIID_VERSION * * 2007-05-16 L. Donnie Smith * * changed cwiid_{connect,disconnect,command} to * cwiid_{open,close,request_status|set_led|set_rumble|set_rpt_mode} * * 2007-05-14 L. Donnie Smith * * added timestamp to message callback * * use cwiid_get_acc_cal to get acc calibration values * * 2007-04-24 L. Donnie Smith * * updated for API overhaul * * 2007-04-09 L. Donnie Smith * * updated for libcwiid rename * * 2007-04-08 L. Donnie Smith * * fixed signed/unsigned comparison warning in btnRead_clicked * * 2007-04-04 L. Donnie Smith * * disconnect on cwiid_mesg_error * * 2007-04-03 L. Donnie Smith * * commented custom cwiid_err (causing Xlib errors) * * 2007-03-01 L. Donnie Smith * * Initial Changelog * * type audit (stdint, const, char booleans) */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #define APP_NAME "CWiid wmgui" #define APP_VERSION PACKAGE_VERSION #define APP_COPYRIGHT "Copyright (C) 2007 L. Donnie Smith " \ "" #define APP_COMMENTS "Wiimote GUI" #include #include #include #include #include #include #include #include #include #include #include "interface.h" #include "support.h" #include #include "cwiid.h" #define PI 3.14159265358979323 struct stick { char valid; uint8_t x; uint8_t y; uint8_t max; }; /* Globals */ cwiid_wiimote_t *wiimote = NULL; bdaddr_t bdaddr; struct acc_cal wm_cal, nc_cal; struct cwiid_ir_mesg ir_data; struct stick nc_stick; struct stick cc_l_stick, cc_r_stick; /* Widgets */ GtkWidget *winMain; GtkWidget *winRW; GtkWidget *winDialog; GtkWidget *menuConnect, *menuDisconnect, *menuQuit, *menuRW, *menuAbout; GtkWidget *chkAcc, *chkIR, *chkExt; GtkWidget *chkLED1, *chkLED2, *chkLED3, *chkLED4; GtkWidget *chkRumble; GtkWidget *evUp, *evDown, *evLeft, *evRight, *evA, *evB, *evMinus, *evPlus, *evHome, *ev1, *ev2; GtkWidget *lblUp, *lblDown, *lblLeft, *lblRight, *lblA, *lblB, *lblMinus, *lblPlus, *lblHome, *lbl1, *lbl2; GtkWidget *lblAccX, *lblAccY, *lblAccZ; GtkWidget *lblAccXVal, *lblAccYVal, *lblAccZVal; GtkWidget *progAccX, *progAccY, *progAccZ; GtkWidget *lblAcc, *lblRoll, *lblPitch; GtkWidget *lblAccVal, *lblRollVal, *lblPitchVal; GtkWidget *lblIR; GtkWidget *drawIR; GtkWidget *lblNC; GtkWidget *drawNCStick; GtkWidget *evNCC, *evNCZ; GtkWidget *lblNCC, *lblNCZ; GtkWidget *lblNCAccX, *lblNCAccY, *lblNCAccZ; GtkWidget *lblNCAccXVal, *lblNCAccYVal, *lblNCAccZVal; GtkWidget *progNCAccX, *progNCAccY, *progNCAccZ; GtkWidget *lblNCAcc, *lblNCRoll, *lblNCPitch; GtkWidget *lblNCAccVal, *lblNCRollVal, *lblNCPitchVal; GtkWidget *evCCUp, *evCCDown, *evCCLeft, *evCCRight, *evCCMinus, *evCCPlus, *evCCHome, *evCCA, *evCCB, *evCCX, *evCCY, *evCCZL, *evCCZR; GtkWidget *lblCCUp, *lblCCDown, *lblCCLeft, *lblCCRight, *lblCCMinus, *lblCCPlus, *lblCCHome, *lblCCA, *lblCCB, *lblCCX, *lblCCY, *lblCCZL, *lblCCZR; GtkWidget *drawCCLStick, *drawCCRStick; GtkWidget *evCCL, *evCCR; GtkWidget *lblCCL, *lblCCR; GtkWidget *lblCCLVal, *lblCCRVal; GtkWidget *progCCL, *progCCR; GtkWidget *statConnection, *statBattery, *statExtension; GtkWidget *txtReadOffset, *txtReadLen; GtkWidget *radReadEEPROM, *radReadReg; GtkWidget *btnRead; GtkWidget *txtWriteOffset, *txtWriteData; GtkWidget *radWriteEEPROM, *radWriteReg; GtkWidget *btnWrite; GtkWidget *tvRW; GtkWidget *btnRWClose; GtkWidget *btnBeep; GtkTextBuffer *tbRW; GdkColor btn_on, btn_off; /* Utility functions */ void set_gui_state(); void clear_widgets(); void clear_acc_widgets(); void clear_ir_data(); void clear_nunchuk_widgets(); void clear_classic_widgets(); void message(GtkMessageType type, const gchar *message, GtkWindow *parent); void status(const gchar *status); /* GTK Callbacks */ gboolean winMain_delete_event(void); gboolean winRW_delete_event(void); void menuConnect_activate(void); void menuDisconnect_activate(void); void menuQuit_activate(void); void menuRW_activate(void); void menuAbout_activate(void); void chkAcc_toggled(void); void chkIR_toggled(void); void chkExt_toggled(void); void chkLED_toggled(void); void chkRumble_toggled(void); void drawIR_expose_event(void); void drawStick_expose_event(GtkWidget *, GdkEventExpose *, struct stick *); void btnRead_clicked(void); void btnWrite_clicked(void); void btnRWClose_clicked(void); void btnBeep_clicked(void); void set_report_mode(void); /* Wiimote Callback */ cwiid_mesg_callback_t cwiid_callback; /* Wiimote Handler Functions */ void cwiid_btn(struct cwiid_btn_mesg *); void cwiid_acc(struct cwiid_acc_mesg *); void cwiid_ir(struct cwiid_ir_mesg *); void cwiid_nunchuk(struct cwiid_nunchuk_mesg *); void cwiid_classic(struct cwiid_classic_mesg *); /* GetOpt */ #define OPTSTRING "h" extern char *optarg; extern int optind, opterr, optopt; #define USAGE "usage:%s [-h] [BDADDR]\n" /* cwiid_err_t err; void err(int id, const char *s, ...) { message(GTK_MESSAGE_ERROR, s, GTK_WINDOW(winMain)); } */ int main (int argc, char *argv[]) { int c; char *str_addr; gtk_set_locale (); gtk_init (&argc, &argv); if (!g_thread_supported()) { g_thread_init(NULL); } gdk_threads_init(); gdk_threads_enter(); /* cwiid_set_err(err); */ /* Parse Options */ while ((c = getopt(argc, argv, OPTSTRING)) != -1) { switch (c) { case 'h': printf(USAGE, argv[0]); return 0; break; case '?': return -1; break; default: printf("unknown command-line option: -%c\n", c); break; } } /* BDADDR */ if (optind < argc) { if (str2ba(argv[optind], &bdaddr)) { printf("invalid bdaddr\n"); bdaddr = *BDADDR_ANY; } optind++; if (optind < argc) { printf("invalid command-line\n"); printf(USAGE, argv[0]); return -1; } } else if ((str_addr = getenv(WIIMOTE_BDADDR)) != NULL) { if (str2ba(str_addr, &bdaddr)) { printf("invalid address in %s\n", WIIMOTE_BDADDR); bdaddr = *BDADDR_ANY; } } else { bdaddr = *BDADDR_ANY; } /* Create the window */ winMain = create_winMain(); winRW = create_winRW(); /* Lookup Widgets */ menuConnect = lookup_widget(winMain, "menuConnect"); menuDisconnect = lookup_widget(winMain, "menuDisconnect"); menuQuit = lookup_widget(winMain, "menuQuit"); menuRW = lookup_widget(winMain, "menuRW"); menuAbout = lookup_widget(winMain, "menuAbout"); chkAcc = lookup_widget(winMain, "chkAcc"); chkIR = lookup_widget(winMain, "chkIR"); chkExt = lookup_widget(winMain, "chkExt"); chkLED1 = lookup_widget(winMain, "chkLED1"); chkLED2 = lookup_widget(winMain, "chkLED2"); chkLED3 = lookup_widget(winMain, "chkLED3"); chkLED4 = lookup_widget(winMain, "chkLED4"); chkRumble = lookup_widget(winMain, "chkRumble"); evUp = lookup_widget(winMain, "evUp"); evDown = lookup_widget(winMain, "evDown"); evLeft = lookup_widget(winMain, "evLeft"); evRight = lookup_widget(winMain, "evRight"); evA = lookup_widget(winMain, "evA"); evB = lookup_widget(winMain, "evB"); evMinus = lookup_widget(winMain, "evMinus"); evPlus = lookup_widget(winMain, "evPlus"); evHome = lookup_widget(winMain, "evHome"); ev1 = lookup_widget(winMain, "ev1"); ev2 = lookup_widget(winMain, "ev2"); lblUp = lookup_widget(winMain, "lblUp"); lblDown = lookup_widget(winMain, "lblDown"); lblLeft = lookup_widget(winMain, "lblLeft"); lblRight = lookup_widget(winMain, "lblRight"); lblA = lookup_widget(winMain, "lblA"); lblB = lookup_widget(winMain, "lblB"); lblMinus = lookup_widget(winMain, "lblMinus"); lblPlus = lookup_widget(winMain, "lblPlus"); lblHome = lookup_widget(winMain, "lblHome"); lbl1 = lookup_widget(winMain, "lbl1"); lbl2 = lookup_widget(winMain, "lbl2"); lblAccX = lookup_widget(winMain, "lblAccX"); lblAccY = lookup_widget(winMain, "lblAccY"); lblAccZ = lookup_widget(winMain, "lblAccZ"); lblAccXVal = lookup_widget(winMain, "lblAccXVal"); lblAccYVal = lookup_widget(winMain, "lblAccYVal"); lblAccZVal = lookup_widget(winMain, "lblAccZVal"); progAccX = lookup_widget(winMain, "progAccX"); progAccY = lookup_widget(winMain, "progAccY"); progAccZ = lookup_widget(winMain, "progAccZ"); lblAcc = lookup_widget(winMain, "lblAcc"); lblRoll = lookup_widget(winMain, "lblRoll"); lblPitch = lookup_widget(winMain, "lblPitch"); lblAccVal = lookup_widget(winMain, "lblAccVal"); lblRollVal = lookup_widget(winMain, "lblRollVal"); lblPitchVal = lookup_widget(winMain, "lblPitchVal"); lblIR = lookup_widget(winMain, "lblIR"); drawIR = lookup_widget(winMain, "drawIR"); lblNC = lookup_widget(winMain, "lblNC"); drawNCStick = lookup_widget(winMain, "drawNCStick"); evNCC = lookup_widget(winMain, "evNCC"); evNCZ = lookup_widget(winMain, "evNCZ"); lblNCC = lookup_widget(winMain, "lblNCC"); lblNCZ = lookup_widget(winMain, "lblNCZ"); lblNCAccX = lookup_widget(winMain, "lblNCAccX"); lblNCAccY = lookup_widget(winMain, "lblNCAccY"); lblNCAccZ = lookup_widget(winMain, "lblNCAccZ"); lblNCAccXVal = lookup_widget(winMain, "lblNCAccXVal"); lblNCAccYVal = lookup_widget(winMain, "lblNCAccYVal"); lblNCAccZVal = lookup_widget(winMain, "lblNCAccZVal"); progNCAccX = lookup_widget(winMain, "progNCAccX"); progNCAccY = lookup_widget(winMain, "progNCAccY"); progNCAccZ = lookup_widget(winMain, "progNCAccZ"); lblNCAcc = lookup_widget(winMain, "lblNCAcc"); lblNCRoll = lookup_widget(winMain, "lblNCRoll"); lblNCPitch = lookup_widget(winMain, "lblNCPitch"); lblNCAccVal = lookup_widget(winMain, "lblNCAccVal"); lblNCRollVal = lookup_widget(winMain, "lblNCRollVal"); lblNCPitchVal = lookup_widget(winMain, "lblNCPitchVal"); evCCUp = lookup_widget(winMain, "evCCUp"); evCCDown = lookup_widget(winMain, "evCCDown"); evCCLeft = lookup_widget(winMain, "evCCLeft"); evCCRight = lookup_widget(winMain, "evCCRight"); evCCMinus = lookup_widget(winMain, "evCCMinus"); evCCPlus = lookup_widget(winMain, "evCCPlus"); evCCHome = lookup_widget(winMain, "evCCHome"); evCCA = lookup_widget(winMain, "evCCA"); evCCB = lookup_widget(winMain, "evCCB"); evCCX = lookup_widget(winMain, "evCCX"); evCCY = lookup_widget(winMain, "evCCY"); evCCZL = lookup_widget(winMain, "evCCZL"); evCCZR = lookup_widget(winMain, "evCCZR"); lblCCUp = lookup_widget(winMain, "lblCCUp"); lblCCDown = lookup_widget(winMain, "lblCCDown"); lblCCLeft = lookup_widget(winMain, "lblCCLeft"); lblCCRight = lookup_widget(winMain, "lblCCRight"); lblCCMinus = lookup_widget(winMain, "lblCCMinus"); lblCCPlus = lookup_widget(winMain, "lblCCPlus"); lblCCHome = lookup_widget(winMain, "lblCCHome"); lblCCA = lookup_widget(winMain, "lblCCA"); lblCCB = lookup_widget(winMain, "lblCCB"); lblCCX = lookup_widget(winMain, "lblCCX"); lblCCY = lookup_widget(winMain, "lblCCY"); lblCCZL = lookup_widget(winMain, "lblCCZL"); lblCCZR = lookup_widget(winMain, "lblCCZR"); drawCCLStick = lookup_widget(winMain, "drawCCLStick"); drawCCRStick = lookup_widget(winMain, "drawCCRStick"); evCCL = lookup_widget(winMain, "evCCL"); evCCR = lookup_widget(winMain, "evCCR"); lblCCL = lookup_widget(winMain, "lblCCL"); lblCCR = lookup_widget(winMain, "lblCCR"); lblCCLVal = lookup_widget(winMain, "lblCCLVal"); lblCCRVal = lookup_widget(winMain, "lblCCRVal"); progCCL = lookup_widget(winMain, "progCCL"); progCCR = lookup_widget(winMain, "progCCR"); statConnection = lookup_widget(winMain, "statConnection"); statBattery = lookup_widget(winMain, "statBattery"); statExtension = lookup_widget(winMain, "statExtension"); txtReadOffset = lookup_widget(winRW, "txtReadOffset"); txtReadLen = lookup_widget(winRW, "txtReadLen"); radReadEEPROM = lookup_widget(winRW, "radReadEEPROM"); radReadReg = lookup_widget(winRW, "radReadReg"); btnRead = lookup_widget(winRW, "btnRead"); txtWriteOffset = lookup_widget(winRW, "txtWriteOffset"); txtWriteData = lookup_widget(winRW, "txtWriteData"); radWriteEEPROM = lookup_widget(winRW, "radWriteEEPROM"); radWriteReg = lookup_widget(winRW, "radWriteReg"); btnWrite = lookup_widget(winRW, "btnWrite"); tvRW = lookup_widget(winRW, "tvRW"); btnRWClose = lookup_widget(winRW, "btnRWClose"); btnBeep = lookup_widget(winMain, "btnBeep"); tbRW = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tvRW)); /* Connect Callbacks */ g_signal_connect(winMain, "delete_event", G_CALLBACK(winMain_delete_event), NULL); g_signal_connect(winRW, "delete_event", G_CALLBACK(winRW_delete_event), NULL); g_signal_connect(menuConnect, "activate", G_CALLBACK(menuConnect_activate), NULL); g_signal_connect(menuDisconnect, "activate", G_CALLBACK(menuDisconnect_activate), NULL); g_signal_connect(menuQuit, "activate", G_CALLBACK(menuQuit_activate), NULL); g_signal_connect(menuRW, "activate", G_CALLBACK(menuRW_activate), NULL); g_signal_connect(menuAbout, "activate", G_CALLBACK(menuAbout_activate), NULL); g_signal_connect(chkAcc, "toggled", G_CALLBACK(chkAcc_toggled), NULL); g_signal_connect(chkIR, "toggled", G_CALLBACK(chkIR_toggled), NULL); g_signal_connect(chkExt, "toggled", G_CALLBACK(chkExt_toggled), NULL); g_signal_connect(chkLED1, "toggled", G_CALLBACK(chkLED_toggled), NULL); g_signal_connect(chkLED2, "toggled", G_CALLBACK(chkLED_toggled), NULL); g_signal_connect(chkLED3, "toggled", G_CALLBACK(chkLED_toggled), NULL); g_signal_connect(chkLED4, "toggled", G_CALLBACK(chkLED_toggled), NULL); g_signal_connect(chkRumble, "toggled", G_CALLBACK(chkRumble_toggled), NULL); g_signal_connect(drawIR, "expose_event", G_CALLBACK(drawIR_expose_event), NULL); g_signal_connect(drawNCStick, "expose_event", G_CALLBACK(drawStick_expose_event), &nc_stick); g_signal_connect(drawCCLStick, "expose_event", G_CALLBACK(drawStick_expose_event), &cc_l_stick); g_signal_connect(drawCCRStick, "expose_event", G_CALLBACK(drawStick_expose_event), &cc_r_stick); g_signal_connect(btnRead, "clicked", G_CALLBACK(btnRead_clicked), NULL); g_signal_connect(btnWrite, "clicked", G_CALLBACK(btnWrite_clicked), NULL); g_signal_connect(btnRWClose, "clicked", G_CALLBACK(btnRWClose_clicked), NULL); g_signal_connect(btnBeep, "clicked", G_CALLBACK(btnBeep_clicked), NULL); /* Initialize */ btn_on.red = 0; btn_on.blue = 0; btn_on.green = 0xFFFF; btn_off = gtk_widget_get_style(evUp)->bg[GTK_STATE_NORMAL]; nc_stick.max = 0xFF; cc_l_stick.max = CWIID_CLASSIC_L_STICK_MAX; cc_r_stick.max = CWIID_CLASSIC_R_STICK_MAX; set_gui_state(); clear_widgets(); status("No connection"); gtk_widget_show(winMain); gtk_main(); gdk_threads_leave(); return 0; } void message(GtkMessageType type, const gchar *message, GtkWindow *parent) { GtkWidget *dialog; dialog = gtk_message_dialog_new(parent, 0, type, GTK_BUTTONS_OK, message); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } void status(const gchar *status) { gtk_statusbar_push(GTK_STATUSBAR(statConnection), 0, status); } void set_gui_state() { gboolean connected; gboolean acc_active; gboolean ext_active; connected = wiimote ? TRUE : FALSE; /* Set Input Widget Sensitivities */ gtk_widget_set_sensitive(menuConnect, !connected); gtk_widget_set_sensitive(menuDisconnect, connected); gtk_widget_set_sensitive(chkLED1, connected); gtk_widget_set_sensitive(chkLED2, connected); gtk_widget_set_sensitive(chkLED3, connected); gtk_widget_set_sensitive(chkLED4, connected); gtk_widget_set_sensitive(chkRumble, connected); gtk_widget_set_sensitive(btnRead, connected); gtk_widget_set_sensitive(btnWrite, connected); /* Set Button Sensitivities */ gtk_widget_set_sensitive(lblUp, connected); gtk_widget_set_sensitive(lblDown, connected); gtk_widget_set_sensitive(lblLeft, connected); gtk_widget_set_sensitive(lblRight, connected); gtk_widget_set_sensitive(lblA, connected); gtk_widget_set_sensitive(lblB, connected); gtk_widget_set_sensitive(lblMinus, connected); gtk_widget_set_sensitive(lblPlus, connected); gtk_widget_set_sensitive(lblHome, connected); gtk_widget_set_sensitive(lbl1, connected); gtk_widget_set_sensitive(lbl2, connected); acc_active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkAcc)); /* Set Acc Widget Sensitivities */ gtk_widget_set_sensitive(lblAccX, acc_active); gtk_widget_set_sensitive(lblAccY, acc_active); gtk_widget_set_sensitive(lblAccZ, acc_active); gtk_widget_set_sensitive(lblAccXVal, acc_active); gtk_widget_set_sensitive(lblAccYVal, acc_active); gtk_widget_set_sensitive(lblAccZVal, acc_active); gtk_widget_set_sensitive(progAccX, acc_active); gtk_widget_set_sensitive(progAccY, acc_active); gtk_widget_set_sensitive(progAccZ, acc_active); gtk_widget_set_sensitive(lblAcc, acc_active); gtk_widget_set_sensitive(lblRoll, acc_active); gtk_widget_set_sensitive(lblPitch, acc_active); gtk_widget_set_sensitive(lblAccVal, acc_active); gtk_widget_set_sensitive(lblRollVal, acc_active); gtk_widget_set_sensitive(lblPitchVal, acc_active); /* Set IC Widget Sensitivities */ gtk_widget_set_sensitive(lblIR, gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkIR))); ext_active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkExt)); /* Set Extension Widget Sensitivities */ gtk_widget_set_sensitive(lblNCC, ext_active); gtk_widget_set_sensitive(lblNCZ, ext_active); gtk_widget_set_sensitive(lblNCAccX, ext_active); gtk_widget_set_sensitive(lblNCAccY, ext_active); gtk_widget_set_sensitive(lblNCAccZ, ext_active); gtk_widget_set_sensitive(lblNCAccXVal, ext_active); gtk_widget_set_sensitive(lblNCAccYVal, ext_active); gtk_widget_set_sensitive(lblNCAccZVal, ext_active); gtk_widget_set_sensitive(progNCAccX, ext_active); gtk_widget_set_sensitive(progNCAccY, ext_active); gtk_widget_set_sensitive(progNCAccZ, ext_active); gtk_widget_set_sensitive(lblNCAcc, ext_active); gtk_widget_set_sensitive(lblNCRoll, ext_active); gtk_widget_set_sensitive(lblNCPitch, ext_active); gtk_widget_set_sensitive(lblNCAccVal, ext_active); gtk_widget_set_sensitive(lblNCRollVal, ext_active); gtk_widget_set_sensitive(lblNCPitchVal, ext_active); gtk_widget_set_sensitive(lblCCUp, ext_active); gtk_widget_set_sensitive(lblCCDown, ext_active); gtk_widget_set_sensitive(lblCCLeft, ext_active); gtk_widget_set_sensitive(lblCCRight, ext_active); gtk_widget_set_sensitive(lblCCMinus, ext_active); gtk_widget_set_sensitive(lblCCPlus, ext_active); gtk_widget_set_sensitive(lblCCHome, ext_active); gtk_widget_set_sensitive(lblCCA, ext_active); gtk_widget_set_sensitive(lblCCB, ext_active); gtk_widget_set_sensitive(lblCCX, ext_active); gtk_widget_set_sensitive(lblCCY, ext_active); gtk_widget_set_sensitive(lblCCZL, ext_active); gtk_widget_set_sensitive(lblCCZR, ext_active); gtk_widget_set_sensitive(lblCCL, ext_active); gtk_widget_set_sensitive(lblCCR, ext_active); gtk_widget_set_sensitive(lblCCLVal, ext_active); gtk_widget_set_sensitive(lblCCRVal, ext_active); gtk_widget_set_sensitive(progCCL, ext_active); gtk_widget_set_sensitive(progCCR, ext_active); } void clear_widgets() { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(chkLED1), FALSE); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(chkLED2), FALSE); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(chkLED3), FALSE); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(chkLED4), FALSE); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(chkRumble), FALSE); gtk_statusbar_push(GTK_STATUSBAR(statBattery), 0, ""); gtk_statusbar_push(GTK_STATUSBAR(statExtension), 0, ""); clear_acc_widgets(); clear_ir_data(); clear_nunchuk_widgets(); clear_classic_widgets(); } void clear_acc_widgets() { gtk_label_set_text(GTK_LABEL(lblAccXVal), "0"); gtk_label_set_text(GTK_LABEL(lblAccYVal), "0"); gtk_label_set_text(GTK_LABEL(lblAccZVal), "0"); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progAccX), 0.0); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progAccY), 0.0); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progAccZ), 0.0); gtk_label_set_text(GTK_LABEL(lblAccVal), "0"); gtk_label_set_text(GTK_LABEL(lblRollVal), "0"); gtk_label_set_text(GTK_LABEL(lblPitchVal), "0"); } void clear_ir_data() { int i; for (i=0; i < CWIID_IR_SRC_COUNT; i++) { ir_data.src[i].pos[CWIID_X] = -1; ir_data.src[i].pos[CWIID_Y] = -1; ir_data.src[i].size = -1; } gtk_widget_queue_draw(drawIR); } void clear_nunchuk_widgets() { nc_stick.valid = 0; gtk_widget_queue_draw(drawNCStick); gtk_label_set_text(GTK_LABEL(lblNCAccXVal), "0"); gtk_label_set_text(GTK_LABEL(lblNCAccYVal), "0"); gtk_label_set_text(GTK_LABEL(lblNCAccZVal), "0"); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progNCAccX), 0.0); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progNCAccY), 0.0); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progNCAccZ), 0.0); gtk_label_set_text(GTK_LABEL(lblNCAccVal), "0"); gtk_label_set_text(GTK_LABEL(lblNCRollVal), "0"); gtk_label_set_text(GTK_LABEL(lblNCPitchVal), "0"); } void clear_classic_widgets() { cc_l_stick.valid = 0; gtk_widget_queue_draw(drawCCLStick); cc_r_stick.valid = 0; gtk_widget_queue_draw(drawCCRStick); gtk_label_set_text(GTK_LABEL(lblCCLVal), "0"); gtk_label_set_text(GTK_LABEL(lblCCRVal), "0"); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progCCL), 0.0); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progCCR), 0.0); } gboolean winMain_delete_event(void) { menuQuit_activate(); return FALSE; } gboolean winRW_delete_event(void) { btnRWClose_clicked(); return TRUE; } void menuConnect_activate(void) { char reset_bdaddr = 0; if (bacmp(&bdaddr, BDADDR_ANY) == 0) { reset_bdaddr = 1; } message(GTK_MESSAGE_INFO, "Put Wiimote in discoverable mode (press 1+2) and press OK", GTK_WINDOW(winMain)); if ((wiimote = cwiid_open(&bdaddr, CWIID_FLAG_MESG_IFC)) == NULL) { message(GTK_MESSAGE_ERROR, "Unable to connect", GTK_WINDOW(winMain)); status("No connection"); } else if (cwiid_set_mesg_callback(wiimote, &cwiid_callback)) { message(GTK_MESSAGE_ERROR, "Error setting callback", GTK_WINDOW(winMain)); if (cwiid_close(wiimote)) { message(GTK_MESSAGE_ERROR, "Error on disconnect", GTK_WINDOW(winMain)); } wiimote = NULL; status("No connection"); } else { status("Connected"); if (cwiid_get_acc_cal(wiimote, CWIID_EXT_NONE, &wm_cal)) { message(GTK_MESSAGE_ERROR, "Unable to retrieve accelerometer " "calibration", GTK_WINDOW(winMain)); } set_gui_state(); set_report_mode(); cwiid_enable(wiimote, CWIID_FLAG_MOTIONPLUS); cwiid_request_status(wiimote); } if (reset_bdaddr) { bdaddr = *BDADDR_ANY; } } void menuDisconnect_activate(void) { if (cwiid_close(wiimote)) { message(GTK_MESSAGE_ERROR, "Error on disconnect", GTK_WINDOW(winMain)); } wiimote = NULL; status("No connection"); clear_widgets(); set_gui_state(); } void menuQuit_activate(void) { if (wiimote) { menuDisconnect_activate(); } gtk_main_quit(); } void menuRW_activate(void) { gtk_widget_show(winRW); } void menuAbout_activate(void) { gtk_show_about_dialog(GTK_WINDOW(winMain), "name", APP_NAME, "version", APP_VERSION, "copyright", APP_COPYRIGHT, "comments", APP_COMMENTS, NULL); } void chkAcc_toggled(void) { if (wiimote) { set_report_mode(); } if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkAcc))) { clear_acc_widgets(); } set_gui_state(); } void chkIR_toggled(void) { if (wiimote) { set_report_mode(); } if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkIR))) { clear_ir_data(); } set_gui_state(); } void chkExt_toggled(void) { if (wiimote) { set_report_mode(); } if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkExt))) { clear_nunchuk_widgets(); clear_classic_widgets(); } set_gui_state(); } void chkLED_toggled(void) { uint8_t LED_state; if (wiimote) { LED_state = (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkLED1)) ? CWIID_LED1_ON : 0) | (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkLED2)) ? CWIID_LED2_ON : 0) | (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkLED3)) ? CWIID_LED3_ON : 0) | (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkLED4)) ? CWIID_LED4_ON : 0); if (cwiid_set_led(wiimote, LED_state)) { message(GTK_MESSAGE_ERROR, "error setting LEDs", GTK_WINDOW(winMain)); } } } void chkRumble_toggled(void) { if (wiimote) { if (cwiid_set_rumble(wiimote, gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkRumble)))) { message(GTK_MESSAGE_ERROR, "error setting rumble", GTK_WINDOW(winMain)); } } } void drawIR_expose_event(void) { int i; int size; gint width, height; gdk_window_get_geometry(drawIR->window, NULL, NULL, &width, &height, NULL); for (i=0; i < CWIID_IR_SRC_COUNT; i++) { if (ir_data.src[i].valid) { if (ir_data.src[i].size == -1) { size = 3; } else { size = ir_data.src[i].size+1; } gdk_draw_arc(drawIR->window, drawIR->style->fg_gc[GTK_WIDGET_STATE(drawIR)], TRUE, ir_data.src[i].pos[CWIID_X] * width / CWIID_IR_X_MAX, height - ir_data.src[i].pos[CWIID_Y] * height / CWIID_IR_Y_MAX, size, size, 0, 64 * 360); } } } void drawStick_expose_event(GtkWidget *drawStick, GdkEventExpose *event, struct stick *stick) { gint width, height; gdk_window_get_geometry(drawStick->window, NULL, NULL, &width, &height, NULL); gdk_draw_arc(drawStick->window, drawStick->style->fg_gc[GTK_WIDGET_STATE(drawStick)], FALSE, 0, 0, width-1, height-1, 0, 64*360); if (stick->valid) { gdk_draw_arc(drawStick->window, drawStick->style->fg_gc[GTK_WIDGET_STATE(drawStick)], TRUE, (double)stick->x/stick->max*width - 2, (1 - (double)stick->y/stick->max)*height - 2, 3, 3, 0, 64*360); } } void btnRead_clicked(void) { static unsigned char buf[CWIID_MAX_READ_LEN]; static char txt[CWIID_MAX_READ_LEN*4+50]; /* 3 chars per byte, with * plenty extra */ GtkTextIter text_iter; GtkTextMark *p_text_mark; char *cursor; unsigned int offset, len; int flags; unsigned int i; /* Decode arguments */ offset = strtol(gtk_entry_get_text(GTK_ENTRY(txtReadOffset)), &cursor, 16); if (*cursor != '\0') { message(GTK_MESSAGE_ERROR, "Invalid read offset", GTK_WINDOW(winRW)); } len = strtol(gtk_entry_get_text(GTK_ENTRY(txtReadLen)), &cursor, 16); if (*cursor != '\0') { message(GTK_MESSAGE_ERROR, "Invalid read len", GTK_WINDOW(winRW)); } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radReadReg))) { flags = CWIID_RW_REG; } else { flags = CWIID_RW_EEPROM; } /* Make the call */ if (cwiid_read(wiimote, flags, offset, len, buf)) { message(GTK_MESSAGE_ERROR, "Wiimote read error", GTK_WINDOW(winRW)); } else { /* construct the hexedit-style string */ cursor=txt; sprintf(cursor, "0x%08X:", offset & ~0xF); cursor+=11; for (i=0; i < (offset & 0xF); i++) { sprintf(cursor, " "); cursor+=3; } for (i=0; i < len; i++) { if ((((i + offset) & 0xF) == 0) && (i!=0)) { sprintf(cursor, "\n0x%08X:", offset+i); cursor+=12; } if (((i +offset) & 0x7) == 0) { sprintf(cursor, " "); cursor++; } sprintf(cursor, "%02X ", buf[i]); cursor+=3; } sprintf(cursor, "\n\n"); gtk_text_buffer_get_end_iter(tbRW, &text_iter); p_text_mark = gtk_text_buffer_create_mark(tbRW, NULL, &text_iter, TRUE); gtk_text_buffer_insert(tbRW, &text_iter, txt, -1); gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(tvRW), p_text_mark, 0.01, TRUE, 0.0, 0.0); } } char chartox(char c) { char str[2]; char *endptr; int val; str[0] = c; str[1] = '\0'; val = strtol(str, &endptr, 16); if (*endptr != '\0') { return -1; } return (char)val; } #define MAX_WRITE_LEN 0x20 void btnWrite_clicked(void) { static unsigned char buf[MAX_WRITE_LEN]; char *cursor, *data; uint32_t offset; uint16_t len; uint8_t flags; /* Decode arguments */ offset = strtol(gtk_entry_get_text(GTK_ENTRY(txtWriteOffset)), &cursor, 16); if (*cursor != '\0') { message(GTK_MESSAGE_ERROR, "Invalid read offset", GTK_WINDOW(winRW)); } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radWriteReg))) { flags = CWIID_RW_REG; } else { flags = CWIID_RW_EEPROM; } data = (char *) gtk_entry_get_text(GTK_ENTRY(txtWriteData)); cursor = data; len = 0; while (*cursor != '\0') { if (len > MAX_WRITE_LEN) { message(GTK_MESSAGE_ERROR, "Message too long", GTK_WINDOW(winRW)); return; } /* Trim Leading spaces */ while (*cursor == ' ') { cursor++; } /* Test for end */ if (*cursor == '\0') { break; } /* Read first nibble */ if (!isxdigit((int)*cursor)) { message(GTK_MESSAGE_ERROR, "Invalid write data", GTK_WINDOW(winRW)); return; } buf[len] = chartox(*cursor)<<4; /* Read second nibble */ cursor++; if (!isxdigit((int)*cursor)) { message(GTK_MESSAGE_ERROR, "Invalid write data (digits must come in pairs)", GTK_WINDOW(winRW)); return; } buf[len] = buf[len] | chartox(*cursor); cursor++; len++; } if (len == 0) { message(GTK_MESSAGE_ERROR, "No write data", GTK_WINDOW(winRW)); return; } /* Make the call */ if (cwiid_write(wiimote, flags, offset, len, buf)) { message(GTK_MESSAGE_ERROR, "Wiimote write error", GTK_WINDOW(winRW)); } else { message(GTK_MESSAGE_INFO, "Wiimote write successful", GTK_WINDOW(winRW)); } } void btnRWClose_clicked(void) { gtk_widget_hide(winRW); } void btnBeep_clicked(void) { /*if (cwiid_beep(wiimote)) { message(GTK_MESSAGE_ERROR, "Wiimote sound error", GTK_WINDOW(winMain)); }*/ } void set_report_mode(void) { uint8_t rpt_mode; rpt_mode = CWIID_RPT_STATUS | CWIID_RPT_BTN; if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkIR))) { rpt_mode |= CWIID_RPT_IR; } if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkAcc))) { rpt_mode |= CWIID_RPT_ACC; } if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkExt))) { rpt_mode |= CWIID_RPT_EXT; } if (cwiid_set_rpt_mode(wiimote, rpt_mode)) { message(GTK_MESSAGE_ERROR, "error setting report mode", GTK_WINDOW(winMain)); } } #define BATTERY_STR_LEN 14 /* "Battery: 100%" + '\0' */ void cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, union cwiid_mesg mesg_array[], struct timespec *timestamp) { int i; char battery[BATTERY_STR_LEN]; char *ext_str; static enum cwiid_ext_type ext_type = CWIID_EXT_NONE; gdk_threads_enter(); for (i=0; i < mesg_count; i++) { switch (mesg_array[i].type) { case CWIID_MESG_STATUS: snprintf(battery, BATTERY_STR_LEN,"Battery:%d%%", (int) (100.0 * mesg_array[i].status_mesg.battery / CWIID_BATTERY_MAX)); gtk_statusbar_push(GTK_STATUSBAR(statBattery), 0, battery); switch (mesg_array[i].status_mesg.ext_type) { case CWIID_EXT_NONE: ext_str = "No extension"; break; case CWIID_EXT_NUNCHUK: ext_str = "Nunchuk"; if (ext_type != CWIID_EXT_NUNCHUK) { if (cwiid_get_acc_cal(wiimote, CWIID_EXT_NUNCHUK, &nc_cal)) { message(GTK_MESSAGE_ERROR, "Unable to retrieve accelerometer calibration", GTK_WINDOW(winMain)); } } break; case CWIID_EXT_CLASSIC: ext_str = "Classic controller"; break; case CWIID_EXT_MOTIONPLUS: ext_str = "MotionPlus"; break; case CWIID_EXT_UNKNOWN: ext_str = "Unknown extension"; break; } gtk_statusbar_push(GTK_STATUSBAR(statExtension), 0, ext_str); clear_nunchuk_widgets(); clear_classic_widgets(); ext_type = mesg_array[i].status_mesg.ext_type; break; case CWIID_MESG_BTN: cwiid_btn(&mesg_array[i].btn_mesg); break; case CWIID_MESG_ACC: cwiid_acc(&mesg_array[i].acc_mesg); break; case CWIID_MESG_IR: cwiid_ir(&mesg_array[i].ir_mesg); break; case CWIID_MESG_NUNCHUK: cwiid_nunchuk(&mesg_array[i].nunchuk_mesg); break; case CWIID_MESG_CLASSIC: cwiid_classic(&mesg_array[i].classic_mesg); break; case CWIID_MESG_ERROR: menuDisconnect_activate(); break; default: break; } } gdk_flush(); gdk_threads_leave(); } void cwiid_btn(struct cwiid_btn_mesg *mesg) { gtk_widget_modify_bg(evUp, GTK_STATE_NORMAL, (mesg->buttons & CWIID_BTN_UP) ? &btn_on : &btn_off); gtk_widget_modify_bg(evDown, GTK_STATE_NORMAL, (mesg->buttons & CWIID_BTN_DOWN) ? &btn_on : &btn_off); gtk_widget_modify_bg(evLeft, GTK_STATE_NORMAL, (mesg->buttons & CWIID_BTN_LEFT) ? &btn_on : &btn_off); gtk_widget_modify_bg(evRight, GTK_STATE_NORMAL, (mesg->buttons & CWIID_BTN_RIGHT) ? &btn_on : &btn_off); gtk_widget_modify_bg(evA, GTK_STATE_NORMAL, (mesg->buttons & CWIID_BTN_A) ? &btn_on : &btn_off); gtk_widget_modify_bg(evB, GTK_STATE_NORMAL, (mesg->buttons & CWIID_BTN_B) ? &btn_on : &btn_off); gtk_widget_modify_bg(evMinus, GTK_STATE_NORMAL, (mesg->buttons & CWIID_BTN_MINUS) ? &btn_on : &btn_off); gtk_widget_modify_bg(evPlus, GTK_STATE_NORMAL, (mesg->buttons & CWIID_BTN_PLUS) ? &btn_on : &btn_off); gtk_widget_modify_bg(evHome, GTK_STATE_NORMAL, (mesg->buttons & CWIID_BTN_HOME) ? &btn_on : &btn_off); gtk_widget_modify_bg(ev1, GTK_STATE_NORMAL, (mesg->buttons & CWIID_BTN_1) ? &btn_on : &btn_off); gtk_widget_modify_bg(ev2, GTK_STATE_NORMAL, (mesg->buttons & CWIID_BTN_2) ? &btn_on : &btn_off); } #define LBLVAL_LEN 6 void cwiid_acc(struct cwiid_acc_mesg *mesg) { static gchar str[LBLVAL_LEN]; double a_x, a_y, a_z, a; double roll, pitch; if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkAcc))) { g_snprintf(str, LBLVAL_LEN, "%X", mesg->acc[CWIID_X]); gtk_label_set_text(GTK_LABEL(lblAccXVal), str); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progAccX), (double)mesg->acc[CWIID_X]/0xFF); g_snprintf(str, LBLVAL_LEN, "%X", mesg->acc[CWIID_Y]); gtk_label_set_text(GTK_LABEL(lblAccYVal), str); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progAccY), (double)mesg->acc[CWIID_Y]/0xFF); g_snprintf(str, LBLVAL_LEN, "%X", mesg->acc[CWIID_Z]); gtk_label_set_text(GTK_LABEL(lblAccZVal), str); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progAccZ), (double)mesg->acc[CWIID_Z]/0xFF); a_x = ((double)mesg->acc[CWIID_X] - wm_cal.zero[CWIID_X]) / (wm_cal.one[CWIID_X] - wm_cal.zero[CWIID_X]); a_y = ((double)mesg->acc[CWIID_Y] - wm_cal.zero[CWIID_Y]) / (wm_cal.one[CWIID_Y] - wm_cal.zero[CWIID_Y]); a_z = ((double)mesg->acc[CWIID_Z] - wm_cal.zero[CWIID_Z]) / (wm_cal.one[CWIID_Z] - wm_cal.zero[CWIID_Z]); a = sqrt(pow(a_x,2)+pow(a_y,2)+pow(a_z,2)); roll = atan(a_x/a_z); if (a_z <= 0.0) { roll += PI * ((a_x > 0.0) ? 1 : -1); } roll *= -1; pitch = atan(a_y/a_z*cos(roll)); g_snprintf(str, LBLVAL_LEN, "%.2f", a); gtk_label_set_text(GTK_LABEL(lblAccVal), str); g_snprintf(str, LBLVAL_LEN, "%.2f", roll); gtk_label_set_text(GTK_LABEL(lblRollVal), str); g_snprintf(str, LBLVAL_LEN, "%.2f", pitch); gtk_label_set_text(GTK_LABEL(lblPitchVal), str); } } void cwiid_ir(struct cwiid_ir_mesg *mesg) { if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkIR))) { /* memcpy(&ir_data, mesg, sizeof(struct cwiid_ir_mesg)); */ ir_data = *mesg; gtk_widget_queue_draw(drawIR); } } void cwiid_nunchuk(struct cwiid_nunchuk_mesg *mesg) { static gchar str[LBLVAL_LEN]; double a_x, a_y, a_z, a; double roll, pitch; if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkExt))) { gtk_widget_modify_bg(evNCC, GTK_STATE_NORMAL, (mesg->buttons & CWIID_NUNCHUK_BTN_C) ? &btn_on : &btn_off); gtk_widget_modify_bg(evNCZ, GTK_STATE_NORMAL, (mesg->buttons & CWIID_NUNCHUK_BTN_Z) ? &btn_on : &btn_off); nc_stick.valid = 1; nc_stick.x = mesg->stick[CWIID_X]; nc_stick.y = mesg->stick[CWIID_Y]; gtk_widget_queue_draw(drawNCStick); g_snprintf(str, LBLVAL_LEN, "%X", mesg->acc[CWIID_X]); gtk_label_set_text(GTK_LABEL(lblNCAccXVal), str); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progNCAccX), (double)mesg->acc[CWIID_X]/0xFF); g_snprintf(str, LBLVAL_LEN, "%X", mesg->acc[CWIID_Y]); gtk_label_set_text(GTK_LABEL(lblNCAccYVal), str); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progNCAccY), (double)mesg->acc[CWIID_Y]/0xFF); g_snprintf(str, LBLVAL_LEN, "%X", mesg->acc[CWIID_Z]); gtk_label_set_text(GTK_LABEL(lblNCAccZVal), str); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progNCAccZ), (double)mesg->acc[CWIID_Z]/0xFF); /* TODO: get nunchuk calibration */ a_x = ((double)mesg->acc[CWIID_X] - nc_cal.zero[CWIID_X]) / (nc_cal.one[CWIID_X] - nc_cal.zero[CWIID_X]); a_y = ((double)mesg->acc[CWIID_Y] - nc_cal.zero[CWIID_Y]) / (nc_cal.one[CWIID_Y] - nc_cal.zero[CWIID_Y]); a_z = ((double)mesg->acc[CWIID_Z] - nc_cal.zero[CWIID_Z]) / (nc_cal.one[CWIID_Z] - nc_cal.zero[CWIID_Z]); a = sqrt(pow(a_x,2)+pow(a_y,2)+pow(a_z,2)); roll = atan(a_x/a_z); if (a_z <= 0.0) { roll += PI * ((a_x > 0.0) ? 1 : -1); } roll *= -1; pitch = atan(a_y/a_z*cos(roll)); g_snprintf(str, LBLVAL_LEN, "%.2f", a); gtk_label_set_text(GTK_LABEL(lblNCAccVal), str); g_snprintf(str, LBLVAL_LEN, "%.2f", roll); gtk_label_set_text(GTK_LABEL(lblNCRollVal), str); g_snprintf(str, LBLVAL_LEN, "%.2f", pitch); gtk_label_set_text(GTK_LABEL(lblNCPitchVal), str); } } void cwiid_classic(struct cwiid_classic_mesg *mesg) { static gchar str[LBLVAL_LEN]; if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkExt))) { gtk_widget_modify_bg(evCCUp, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_UP) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCDown, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_DOWN) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCLeft, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_LEFT) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCRight, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_RIGHT) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCMinus, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_MINUS) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCPlus, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_PLUS) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCHome, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_HOME) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCA, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_A) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCB, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_B) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCX, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_X) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCY, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_Y) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCZL, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_ZL) ? &btn_on : &btn_off); gtk_widget_modify_bg(evCCZR, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_ZR) ? &btn_on : &btn_off); cc_l_stick.valid = 1; cc_l_stick.x = mesg->l_stick[CWIID_X]; cc_l_stick.y = mesg->l_stick[CWIID_Y]; gtk_widget_queue_draw(drawCCLStick); cc_r_stick.valid = 1; cc_r_stick.x = mesg->r_stick[CWIID_X]; cc_r_stick.y = mesg->r_stick[CWIID_Y]; gtk_widget_queue_draw(drawCCRStick); g_snprintf(str, LBLVAL_LEN, "%X", mesg->l); gtk_label_set_text(GTK_LABEL(lblCCLVal), str); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progCCL), (double)mesg->l/CWIID_CLASSIC_LR_MAX); gtk_widget_modify_bg(evCCL, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_L) ? &btn_on : &btn_off); g_snprintf(str, LBLVAL_LEN, "%X", mesg->r); gtk_label_set_text(GTK_LABEL(lblCCRVal), str); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progCCR), (double)mesg->r/CWIID_CLASSIC_LR_MAX); gtk_widget_modify_bg(evCCR, GTK_STATE_NORMAL, (mesg->buttons & CWIID_CLASSIC_BTN_R) ? &btn_on : &btn_off); } } cwiid-0.6.00+svn201/wmgui/wmgui.gladep.bak0000644000175000017500000000111110567071413017213 0ustar tootstoots wmgui wmgui FALSE FALSE TRUE FALSE FALSE FALSE cwiid-0.6.00+svn201/wmgui/wmgui.gladep0000644000175000017500000000111110567071413016457 0ustar tootstoots wmgui wmgui FALSE FALSE TRUE FALSE FALSE FALSE cwiid-0.6.00+svn201/README0000644000175000017500000001056011017374470013711 0ustar tootstootsCopyright (C) 2007 L. Donnie Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ------------------------------------------------------------------------------------------------ CWiid Wiimote Interface ------------------------------------------------------------------------------------------------ DESCRIPTION ------------------------------------------------------------------------------------------------ The CWiid package contains the following parts: 1.libcwiid - wiimote API. 2.cwiid module - python interface to libcwiid 3.wmgui - GTK gui to the wiimote. 4.wminput - an event/joystick/mouse driver for the wiimote. 5.lswm - list wiimote devices (in the spirit of ls{,pci,usb}, etc. 6.wmdemo - a minimal demonstration of the libwiimote API. (not installed) REQUIREMENTS ------------------------------------------------------------------------------------------------ awk, bison, flex, bluez-libs, gtk+-2 dev libs, python 2.4 or greater, python dev for python module, uinput kernel support, kernel sources INSTALLATION ------------------------------------------------------------------------------------------------ ./configure make sudo make install To install global configuration files to the more familiar /etc rather than /usr/etc or /usr/local/etc, execute configure with --sysconfdir=/etc. While CWiid is still in the early development stages, installation directories and filenames are changed more often than in a mature, stable package. In order to prevent the collection of obselete directories and files, it is recommended that you run 'make uninstall && make uninstall_config' from your current CWiid source directory before installing a new one. Files are currently installed to the following directories: /usr/local/{bin,etc,lib,lib/cwiid,lib/python2.X/site-packages,share/doc,share/man}. Recently, but no longer, used directories include /usr/share/CWiid - this directory may be deleted. Many distributions do not have /usr/local/lib in the library search path, and on many of these same distributions, the library installation directory (as determined by autoconf) is /usr/local/lib, creating a problem when you try to run programs depending on libraries installed there. There are two clean ways to fix this: 1.Add a --prefix=/usr argument to ./configure 2.Add /usr/local/lib to /etc/ld.so.conf, then run ldconfig. I prefer the second method since it keeps local software in the local directory where it should be, and it fixes the problem for every package using /usr/local/lib, not just CWiid. Until someone offers a convincing argument for the omission of /usr/local/lib from /etc/ld.so.conf, I consider this to be a distribution bug, and method #2 above is the fix. Please report any compilation errors at http://www.abstrakraft.org/cwiid or to , with preference for the former. EXECUTION ------------------------------------------------------------------------------------------------ wmgui [-h] [bdaddr] wminput [-h] [-c config] [bdaddr] The bluetooth device address (bdaddr) of the wiimote can be specified on the command-line, or through the WIIMOTE_BDADDR environment variable, in that order of precedence. If neither is given, the first wiimote found by hci_inquiry will be used. See wminput/README for more information on wminput configuration and execution. FUTURE IDEAS/IMPROVEMENTS ------------------------------------------------------------------------------------------------ The following list is neither complete nor ordered: wmcp (copy data between files and wiimotes) Move wiimote communications into a separate daemon (wiimoted) with which applications communicate via sockets (or some other means) wmgui logging Implement speaker gui/control interface to wminput Implement other drivers such as gesture recognition. cwiid-0.6.00+svn201/configure0000755000175000017500000045646411260043503014747 0ustar tootstoots#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.64 for CWiid 0.6.00. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software # Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: cwiid@abstrakraft.org about your system, including any $0: error possibly output before this message. Then install $0: a modern shell, or manually run the script under such a $0: shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error ERROR [LINENO LOG_FD] # --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with status $?, using 1 if that was 0. as_fn_error () { as_status=$?; test $as_status -eq 0 && as_status=1 if test "$3"; then as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='CWiid' PACKAGE_TARNAME='cwiid' PACKAGE_VERSION='0.6.00' PACKAGE_STRING='CWiid 0.6.00' PACKAGE_BUGREPORT='cwiid@abstrakraft.org' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS GTK_LIBS GTK_CFLAGS PKG_CONFIG LDCONFIG CWIID_PLUGINS_DIR CWIID_CONFIG_DIR EGREP GREP CPP PYTHON_VERSION PYTHON YFLAGS YACC LEXLIB LEX_OUTPUT_ROOT LEX AWK OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_python with_cwiid_config_dir with_cwiid_plugins_dir with_ldconfig ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS YACC YFLAGS CPP PKG_CONFIG GTK_CFLAGS GTK_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error "unrecognized option: \`$ac_option' Try \`$0 --help' for more information." ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures CWiid 0.6.00 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/cwiid] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of CWiid 0.6.00:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-python compile without python support --with-cwiid-config-dir CWiid configuration directory, default to $(sysconfdir)/cwiid --with-cwiid-plugins-dir CWiid plugins directory, default to $(libdir)/cwiid/plugins --disable-ldconfig don't execute ldconfig after install Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory YACC The `Yet Another C Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. CPP C preprocessor PKG_CONFIG path to pkg-config utility GTK_CFLAGS C compiler flags for GTK, overriding pkg-config GTK_LIBS linker flags for GTK, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF CWiid configure 0.6.00 generated by GNU Autoconf 2.64 Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} return $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} return $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} return $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} return $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to cwiid@abstrakraft.org ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by CWiid $as_me 0.6.00, which was generated by GNU Autoconf 2.64. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers common/include/config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "no acceptable C compiler found in \$PATH See \`config.log' for more details." "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 rm -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } if test -z "$ac_file"; then : $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "C compiler cannot create executables See \`config.log' for more details." "$LINENO" 5; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of object files: cannot compile See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_LEX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LEX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 $as_echo "$LEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test "x$LEX" != "x:"; then cat >conftest.l <<_ACEOF %% a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } e { yyless (input () != 0); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% #ifdef YYTEXT_POINTER extern char *yytext; #endif int main (void) { return ! yylex () + ! yywrap (); } _ACEOF { { ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } if test "${ac_cv_prog_lex_root+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else as_fn_error "cannot find output from $LEX; giving up" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 $as_echo "$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } if test "${ac_cv_lib_lex+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS=$LIBS ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lex=$ac_lib fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 $as_echo "$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_lex_yytext_pointer=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi if test "$LEX" != "flex"; then as_fn_error "flex not found" "$LINENO" 5 fi if test -z "`echo %%|$LEX -t|grep yypop_buffer_state`"; then as_fn_error "flex missing yypop_buffer_state - upgrade to version 2.5.33 or later" "$LINENO" 5 fi for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_YACC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" if test "$YACC" != "bison -y"; then as_fn_error "bison not found" "$LINENO" 5 fi # Check whether --with-python was given. if test "${with_python+set}" = set; then : withval=$with_python; case $withval in yes) REQUIRE_PYTHON=1 PYTHON_NAME=python ;; no) REQUIRE_PYTHON= PYTHON_NAME= ;; *) REQUIRE_PYTHON=1 PYTHON_NAME=$withval ;; esac else REQUIRE_PYTHON=1; PYTHON_NAME=python fi if test $REQUIRE_PYTHON; then for ac_prog in $PYTHON_NAME do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_PYTHON+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHON="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PYTHON" && break done if test $REQUIRE_PYTHON -a ! $PYTHON; then as_fn_error "$PYTHON_NAME not found" "$LINENO" 5 fi fi if test $PYTHON; then PYTHON_VERSION=`$PYTHON -c 'import sys; print sys.version[:3]'` $as_echo "#define HAVE_PYTHON 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" else as_fn_error "pthread library not found" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hci_devid in -lbluetooth" >&5 $as_echo_n "checking for hci_devid in -lbluetooth... " >&6; } if test "${ac_cv_lib_bluetooth_hci_devid+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbluetooth $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char hci_devid (); int main () { return hci_devid (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bluetooth_hci_devid=yes else ac_cv_lib_bluetooth_hci_devid=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bluetooth_hci_devid" >&5 $as_echo "$ac_cv_lib_bluetooth_hci_devid" >&6; } if test "x$ac_cv_lib_bluetooth_hci_devid" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBBLUETOOTH 1 _ACEOF LIBS="-lbluetooth $LIBS" else as_fn_error "bluetooth library not found" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF LIBS="-ldl $LIBS" else as_fn_error "dl lib not found" "$LINENO" 5 fi #AC_CHECK_LIB([rt], [clock_gettime],, # AC_MSG_ERROR([rt lib not found])) ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " eval as_val=\$$as_ac_Header if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" if test "x$ac_cv_header_stdint_h" = x""yes; then : else as_fn_error "stdint.h not found" "$LINENO" 5 fi ac_fn_c_check_header_mongrel "$LINENO" "bluetooth/bluetooth.h" "ac_cv_header_bluetooth_bluetooth_h" "$ac_includes_default" if test "x$ac_cv_header_bluetooth_bluetooth_h" = x""yes; then : else as_fn_error "bluetooth/bluetooth.h not found" "$LINENO" 5 fi for ac_header in bluetooth/l2cap.h bluetooth/hci.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#include " eval as_val=\$$as_ac_Header if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else as_fn_error "bluetooth headers not found" "$LINENO" 5 fi done ac_fn_c_check_header_mongrel "$LINENO" "linux/input.h" "ac_cv_header_linux_input_h" "$ac_includes_default" if test "x$ac_cv_header_linux_input_h" = x""yes; then : else as_fn_error "linux/input.h not found" "$LINENO" 5 fi ac_fn_c_check_header_compile "$LINENO" "linux/uinput.h" "ac_cv_header_linux_uinput_h" "#include " if test "x$ac_cv_header_linux_uinput_h" = x""yes; then : else as_fn_error "linux/uinput.h" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 $as_echo_n "checking for library containing strerror... " >&6; } if test "${ac_cv_search_strerror+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strerror (); int main () { return strerror (); ; return 0; } _ACEOF for ac_lib in '' cposix; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_strerror=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_strerror+set}" = set; then : break fi done if test "${ac_cv_search_strerror+set}" = set; then : else ac_cv_search_strerror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 $as_echo "$ac_cv_search_strerror" >&6; } ac_res=$ac_cv_search_strerror if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # Check whether --with-cwiid-config-dir was given. if test "${with_cwiid_config_dir+set}" = set; then : withval=$with_cwiid_config_dir; fi if test -z $with_cwiid_config_dir; then CWIID_CONFIG_DIR='${sysconfdir}/cwiid' else CWIID_CONFIG_DIR=$with_cwiid_config_dir fi # Check whether --with-cwiid-plugins-dir was given. if test "${with_cwiid_plugins_dir+set}" = set; then : withval=$with_cwiid_plugins_dir; fi if test -n $with_cwiid_plugins_dir; then CWIID_PLUGINS_DIR='${libdir}/cwiid/plugins' else CWIID_PLUGINS_DIR=$with_cwiid_plugins_dir fi # Check whether --with-ldconfig was given. if test "${with_ldconfig+set}" = set; then : withval=$with_ldconfig; fi if test "$enable_ldconfig" = "no"; then LDCONFIG="#ldconfig" else LDCONFIG="ldconfig" fi pkg_modules="gtk+-2.0 >= 2.0.0 gthread-2.0" if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK" >&5 $as_echo_n "checking for GTK... " >&6; } if test -n "$PKG_CONFIG"; then if test -n "$GTK_CFLAGS"; then pkg_cv_GTK_CFLAGS="$GTK_CFLAGS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$pkg_modules\""; } >&5 ($PKG_CONFIG --exists --print-errors "$pkg_modules") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GTK_CFLAGS=`$PKG_CONFIG --cflags "$pkg_modules" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then if test -n "$GTK_LIBS"; then pkg_cv_GTK_LIBS="$GTK_LIBS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$pkg_modules\""; } >&5 ($PKG_CONFIG --exists --print-errors "$pkg_modules") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GTK_LIBS=`$PKG_CONFIG --libs "$pkg_modules" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then GTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$pkg_modules"` else GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$pkg_modules"` fi # Put the nasty error message in config.log where it belongs echo "$GTK_PKG_ERRORS" >&5 as_fn_error "Package requirements ($pkg_modules) were not met: $GTK_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables GTK_CFLAGS and GTK_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " "$LINENO" 5 elif test $pkg_failed = untried; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables GTK_CFLAGS and GTK_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." "$LINENO" 5; } else GTK_CFLAGS=$pkg_cv_GTK_CFLAGS GTK_LIBS=$pkg_cv_GTK_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } : fi ac_config_files="$ac_config_files Makefile defs.mak common/include/lib.mak doc/Makefile man/Makefile libcwiid/Makefile libcwiid/cwiid.pc wmdemo/Makefile wmgui/Makefile wminput/Makefile wminput/plugins/Makefile wminput/plugins/ir_ptr/Makefile wminput/plugins/acc/Makefile wminput/plugins/nunchuk_acc/Makefile wminput/plugins/led/Makefile wminput/plugins/nunchuk_stick2btn/Makefile lswm/Makefile python/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error ERROR [LINENO LOG_FD] # --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with status $?, using 1 if that was 0. as_fn_error () { as_status=$?; test $as_status -eq 0 && as_status=1 if test "$3"; then as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by CWiid $as_me 0.6.00, which was generated by GNU Autoconf 2.64. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ CWiid config.status 0.6.00 configured by $0, generated by GNU Autoconf 2.64, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "common/include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS common/include/config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "defs.mak") CONFIG_FILES="$CONFIG_FILES defs.mak" ;; "common/include/lib.mak") CONFIG_FILES="$CONFIG_FILES common/include/lib.mak" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "libcwiid/Makefile") CONFIG_FILES="$CONFIG_FILES libcwiid/Makefile" ;; "libcwiid/cwiid.pc") CONFIG_FILES="$CONFIG_FILES libcwiid/cwiid.pc" ;; "wmdemo/Makefile") CONFIG_FILES="$CONFIG_FILES wmdemo/Makefile" ;; "wmgui/Makefile") CONFIG_FILES="$CONFIG_FILES wmgui/Makefile" ;; "wminput/Makefile") CONFIG_FILES="$CONFIG_FILES wminput/Makefile" ;; "wminput/plugins/Makefile") CONFIG_FILES="$CONFIG_FILES wminput/plugins/Makefile" ;; "wminput/plugins/ir_ptr/Makefile") CONFIG_FILES="$CONFIG_FILES wminput/plugins/ir_ptr/Makefile" ;; "wminput/plugins/acc/Makefile") CONFIG_FILES="$CONFIG_FILES wminput/plugins/acc/Makefile" ;; "wminput/plugins/nunchuk_acc/Makefile") CONFIG_FILES="$CONFIG_FILES wminput/plugins/nunchuk_acc/Makefile" ;; "wminput/plugins/led/Makefile") CONFIG_FILES="$CONFIG_FILES wminput/plugins/led/Makefile" ;; "wminput/plugins/nunchuk_stick2btn/Makefile") CONFIG_FILES="$CONFIG_FILES wminput/plugins/nunchuk_stick2btn/Makefile" ;; "lswm/Makefile") CONFIG_FILES="$CONFIG_FILES lswm/Makefile" ;; "python/Makefile") CONFIG_FILES="$CONFIG_FILES python/Makefile" ;; *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || as_fn_error "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit $? fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cwiid-0.6.00+svn201/configure.ac0000644000175000017500000000766511030247111015315 0ustar tootstoots# ChangeLog: # 2007-07-28 L. Donnie Smith # * added config.h header # * added with-python argument and associated logic # # 2007-05-30 L. Donnie Smith # * added python/Makefile # * added PYTHON_VERSION variable # # 2007-04-09 L. Donnie Smith # * updated for libcwiid rename # # 2007-04-04 L. Donnie Smith # * removed --noyywrap from lex # # 2007-04-01 L. Donnie Smith # * added lswm/Makefile # * moved defs.mak # # 2007-03-19 L. Donnie Smith # * added --disable-ldconfig # # 2007-03-01 L. Donnie Smith # * Initial ChangeLog # * Check for stdint.h AC_INIT(CWiid,0.6.00,cwiid@abstrakraft.org) AC_CONFIG_HEADER(common/include/config.h) AC_PROG_CC AC_PROG_AWK AC_PROG_LEX if test "$LEX" != "flex"; then AC_MSG_ERROR([flex not found]) fi if test -z "`echo %%|$LEX -t|grep yypop_buffer_state`"; then AC_MSG_ERROR([flex missing yypop_buffer_state - upgrade to version 2.5.33 or later]) fi AC_PROG_YACC if test "$YACC" != "bison -y"; then AC_MSG_ERROR([bison not found]) fi AC_ARG_WITH( [python], [AS_HELP_STRING([--without-python],[compile without python support])], [case $withval in yes) REQUIRE_PYTHON=1 PYTHON_NAME=python ;; no) REQUIRE_PYTHON= PYTHON_NAME= ;; *) REQUIRE_PYTHON=1 PYTHON_NAME=$withval ;; esac], [REQUIRE_PYTHON=1; PYTHON_NAME=python]) if test $REQUIRE_PYTHON; then AC_CHECK_PROGS([PYTHON],$PYTHON_NAME) if test $REQUIRE_PYTHON -a ! $PYTHON; then AC_MSG_ERROR([$PYTHON_NAME not found]) fi fi AC_SUBST(PYTHON) if test $PYTHON; then PYTHON_VERSION=[`$PYTHON -c 'import sys; print sys.version[:3]'`] AC_SUBST(PYTHON_VERSION) AC_DEFINE([HAVE_PYTHON],1,[Define to 1 if python support is enabled]) fi AC_CHECK_LIB([pthread], [pthread_create],, AC_MSG_ERROR([pthread library not found])) AC_CHECK_LIB([bluetooth], [hci_devid],, AC_MSG_ERROR([bluetooth library not found])) AC_CHECK_LIB([dl], [dlopen],, AC_MSG_ERROR([dl lib not found])) #AC_CHECK_LIB([rt], [clock_gettime],, # AC_MSG_ERROR([rt lib not found])) AC_HEADER_STDC AC_CHECK_HEADER([stdint.h],, AC_MSG_ERROR([stdint.h not found])) AC_CHECK_HEADER([bluetooth/bluetooth.h],, AC_MSG_ERROR([bluetooth/bluetooth.h not found])) AC_CHECK_HEADERS([bluetooth/l2cap.h bluetooth/hci.h],, AC_MSG_ERROR([bluetooth headers not found]), [#include ]) AC_CHECK_HEADER([linux/input.h],, AC_MSG_ERROR([linux/input.h not found])) AC_CHECK_HEADER([linux/uinput.h],, AC_MSG_ERROR([linux/uinput.h]), [#include ]) AC_ISC_POSIX AC_ARG_WITH(cwiid-config-dir,AC_HELP_STRING([--with-cwiid-config-dir], [CWiid configuration directory, default to $(sysconfdir)/cwiid])) if test -z $with_cwiid_config_dir; then CWIID_CONFIG_DIR='${sysconfdir}/cwiid' else CWIID_CONFIG_DIR=$with_cwiid_config_dir fi AC_SUBST(CWIID_CONFIG_DIR) AC_ARG_WITH(cwiid-plugins-dir,AC_HELP_STRING([--with-cwiid-plugins-dir], [CWiid plugins directory, default to $(libdir)/cwiid/plugins])) if test -n $with_cwiid_plugins_dir; then CWIID_PLUGINS_DIR='${libdir}/cwiid/plugins' else CWIID_PLUGINS_DIR=$with_cwiid_plugins_dir fi AC_SUBST(CWIID_PLUGINS_DIR) AC_ARG_WITH(ldconfig,AC_HELP_STRING([--disable-ldconfig], [don't execute ldconfig after install])) if test "$enable_ldconfig" = "no"; then LDCONFIG="#ldconfig" else LDCONFIG="ldconfig" fi AC_SUBST(LDCONFIG) pkg_modules="gtk+-2.0 >= 2.0.0 gthread-2.0" PKG_CHECK_MODULES([GTK], [$pkg_modules]) AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) AC_OUTPUT( [Makefile] [defs.mak] [common/include/lib.mak] [doc/Makefile] [man/Makefile] [libcwiid/Makefile] [libcwiid/cwiid.pc] [wmdemo/Makefile] [wmgui/Makefile] [wminput/Makefile] [wminput/plugins/Makefile] [wminput/plugins/ir_ptr/Makefile] [wminput/plugins/acc/Makefile] [wminput/plugins/nunchuk_acc/Makefile] [wminput/plugins/led/Makefile] [wminput/plugins/nunchuk_stick2btn/Makefile] [lswm/Makefile] [python/Makefile] ) cwiid-0.6.00+svn201/common/0000755000175000017500000000000011260043406014307 5ustar tootstootscwiid-0.6.00+svn201/common/include/0000755000175000017500000000000011260043516015734 5ustar tootstootscwiid-0.6.00+svn201/common/include/dep.mak0000644000175000017500000000016510567071413017206 0ustar tootstoots%.d: %.c @$(CC) -M $(CFLAGS) $< > $@.$$$$; \ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$ cwiid-0.6.00+svn201/common/include/config.h.in~0000644000175000017500000000361011017400020020140 0ustar tootstoots/* common/include/config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_BLUETOOTH_HCI_H /* Define to 1 if you have the header file. */ #undef HAVE_BLUETOOTH_L2CAP_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `bluetooth' library (-lbluetooth). */ #undef HAVE_LIBBLUETOOTH /* Define to 1 if you have the `dl' library (-ldl). */ #undef HAVE_LIBDL /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if python support is enabled */ #undef HAVE_PYTHON /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER cwiid-0.6.00+svn201/common/include/plugin.mak0000644000175000017500000000137210634140413017725 0ustar tootstoots#Copyright (C) 2007 L. Donnie Smith LIB_NAME = $(PLUGIN_NAME).so OBJECTS = $(SOURCES:.c=.o) DEPS = $(SOURCES:.c=.d) CFLAGS += -fpic #TODO:unify the way ROOTDIR is handled #Currently, defs.mak adds ROOTDIR to the plugin INST_DIR, #so we don't do it here #DEST_INST_DIR = $(ROOTDIR)/$(INST_DIR) DEST_INST_DIR = $(INST_DIR) all: $(LIB_NAME) $(LIB_NAME): $(OBJECTS) $(CC) -shared $(LDFLAGS) $(LDLIBS) -o $(LIB_NAME) $(OBJECTS) install: $(LIB_NAME) install -D $(LIB_NAME) $(DEST_INST_DIR)/$(LIB_NAME) clean: rm -f $(LIB_NAME) $(OBJECTS) $(DEPS) uninstall: rm -f $(INST_DIR)/$(LIB_NAME) ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),distclean) include $(COMMON)/include/dep.mak -include $(DEPS) endif endif .PHONY: all install clean uninstall cwiid-0.6.00+svn201/common/include/config.h.in0000644000175000017500000000371411260043503017760 0ustar tootstoots/* common/include/config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_BLUETOOTH_HCI_H /* Define to 1 if you have the header file. */ #undef HAVE_BLUETOOTH_L2CAP_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `bluetooth' library (-lbluetooth). */ #undef HAVE_LIBBLUETOOTH /* Define to 1 if you have the `dl' library (-ldl). */ #undef HAVE_LIBDL /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if python support is enabled */ #undef HAVE_PYTHON /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER cwiid-0.6.00+svn201/common/include/app.mak0000644000175000017500000000110410634140413017200 0ustar tootstoots#Copyright (C) 2007 L. Donnie Smith OBJECTS = $(SOURCES:.c=.o) DEPS = $(SOURCES:.c=.d) INST_DIR ?= /usr/local/bin DEST_INST_DIR = $(ROOTDIR)$(INST_DIR) all: $(APP_NAME) $(APP_NAME): $(OBJECTS) $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(LDLIBS) install: $(APP_NAME) install -D $(APP_NAME) $(DEST_INST_DIR)/$(APP_NAME) clean: rm -f $(APP_NAME) $(OBJECTS) $(DEPS) uninstall: rm -f $(DEST_INST_DIR)/$(APP_NAME) ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),distclean) include $(COMMON)/include/dep.mak -include $(DEPS) endif endif .PHONY: all install uninstall clean cwiid-0.6.00+svn201/common/include/lib.mak.in0000644000175000017500000000270510634140413017603 0ustar tootstoots#Copyright (C) 2007 L. Donnie Smith LDCONFIG = @LDCONFIG@ HEADER = $(LIB_NAME).h STATIC_LIB = lib$(LIB_NAME).a LINK_NAME = lib$(LIB_NAME).so SO_NAME = $(LINK_NAME).$(MAJOR_VER) SHARED_LIB = $(SO_NAME).$(MINOR_VER) DEST_INC_INST_DIR = $(ROOTDIR)$(INC_INST_DIR) DEST_LIB_INST_DIR = $(ROOTDIR)$(LIB_INST_DIR) OBJECTS = $(SOURCES:.c=.o) DEPS = $(SOURCES:.c=.d) CFLAGS += -fpic all: static shared static: $(STATIC_LIB) shared: $(SHARED_LIB) $(STATIC_LIB): $(OBJECTS) ar rcs $(STATIC_LIB) $(OBJECTS) $(SHARED_LIB): $(OBJECTS) $(CC) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) $(LDLIBS) \ -o $(SHARED_LIB) $(OBJECTS) install: install_header install_static install_shared install_header: install -D $(LIB_NAME).h $(DEST_INC_INST_DIR)/$(LIB_NAME).h install_static: static install -D $(STATIC_LIB) $(DEST_LIB_INST_DIR)/$(STATIC_LIB) install_shared: shared install -D $(SHARED_LIB) $(DEST_LIB_INST_DIR)/$(SHARED_LIB) ln -sf $(SHARED_LIB) $(DEST_LIB_INST_DIR)/$(SO_NAME) ln -sf $(SO_NAME) $(DEST_LIB_INST_DIR)/$(LINK_NAME) $(LDCONFIG) clean: rm -f $(STATIC_LIB) $(SHARED_LIB) $(OBJECTS) $(DEPS) uninstall: rm -f $(DEST_INC_INST_DIR)/$(LIB_NAME).h \ $(DEST_LIB_INST_DIR)/$(STATIC_LIB) \ $(DEST_LIB_INST_DIR)/$(LINK_NAME)* ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),distclean) include $(COMMON)/include/dep.mak -include $(DEPS) endif endif .PHONY: all static shared install install_header install_static install_shared clean uninstall cwiid-0.6.00+svn201/Makefile.in0000644000175000017500000000217210652707447015106 0ustar tootstoots#Copyright (C) 2007 L. Donnie Smith include @top_builddir@/defs.mak LIB_DIRS = libcwiid BIN_DIRS = wmgui wminput lswm DOC_DIRS = man doc ifdef PYTHON BIND_DIRS = python endif SUB_DIRS = $(LIB_DIRS) $(BIN_DIRS) $(DOC_DIRS) $(BIND_DIRS) wmdemo all install clean distclean uninstall: TARGET += $(MAKECMDGOALS) all install clean distclean uninstall: $(BIN_DIRS) $(LIB_DIRS) $(BIND_DIRS) install uninstall distclean: $(DOC_DIRS) all clean distclean: wmdemo ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),distclean) $(BIN_DIRS) $(BIND_DIRS): $(LIB_DIRS) endif endif ifeq ($(MAKECMDGOALS),install) $(BIN_DIRS) $(LIB_DIRS): $(CWIID_CONFIG_DIR) $(CWIID_PLUGINS_DIR) endif $(SUB_DIRS): $(MAKE) $(TARGET) -C $@ $(CWIID_CONFIG_DIR): install -d $(CWIID_CONFIG_DIR) $(CWIID_PLUGINS_DIR): install -d $(CWIID_PLUGINS_DIR) distclean: rm -rf Makefile config.log config.status autom4te.cache \ defs.mak $(COMMON)/include/lib.mak $(COMMON)/include/config.h uninstall: rm -r $(CWIID_PLUGINS_DIR); true uninstall_config: rm -rf $(CWIID_CONFIG_DIR) .PHONY: all install clean distclean uninstall uninstall_config $(SUB_DIRS) .NOTPARALLEL: cwiid-0.6.00+svn201/python/0000755000175000017500000000000011260043516014342 5ustar tootstootscwiid-0.6.00+svn201/python/Wiimote.c0000644000175000017500000007174211223453733016143 0ustar tootstoots/* * Copyright (C) 2007 Justin M. Tulloss * * Interface from Python to libcwiid * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA * * ChangeLog: * 2008-01-19 L. Donnie Smith * * print callback error tracebacks * * 2007-06-18 L. Donnie Smith * * revised error messages and doc strings * * 2007-06-05 L. Donnie Smith * * removed Wiimote_FromC function * * added bdaddr argument to Wiimote.init * * overloaded Wiimote.init to accept CObject (existing wiimote), * and logic to avoid closing it on dealloc * * 2007-06-01 L. Donnie Smith * * added Wiimote_FromC * * added get_acc_cal * * 2007-05-27 Arthur Peters * * removed set_mesg_callback from methods table * * 2007-05-22 L. Donnie Smith * * changed disconnect to close * * replaced command with attributes for rpt_mode, rumble, led, * added request_status method * * fixed memory leak in get_mesg * * added function names to argument parsing errors * * changed to processMesg to ConvertMesgArray with global visibility * * 2007-05-15 L. Donnie Smith * * revised message types * * revised argument/keylist parsing * * 2007-05-14 L. Donnie Smith * * moved Wiimote class to separate file */ #include "Python.h" #include "structmember.h" #include #include #include "cwiid.h" #if (PY_VERSION_HEX < 0x02050000) #ifndef PY_SSIZE_T_MIN typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif #endif typedef struct { PyObject_HEAD cwiid_wiimote_t *wiimote; PyObject *callback; char close_on_dealloc; } Wiimote; /* method prototypes */ static PyObject * Wiimote_new(PyTypeObject *type, PyObject *args, PyObject *kwds); static void Wiimote_dealloc(Wiimote *self); static int Wiimote_init(Wiimote *self, PyObject *args, PyObject *kwds); static PyObject *Wiimote_close(Wiimote *self); static PyObject *Wiimote_enable(Wiimote *self, PyObject *args, PyObject *kwds); static PyObject * Wiimote_disable(Wiimote *self, PyObject *args, PyObject *kwds); static int Wiimote_set_mesg_callback(Wiimote *self, PyObject *args, void *closure); static PyObject *Wiimote_get_mesg(Wiimote *self); static PyObject *Wiimote_get_state(Wiimote *self, void *closure); static PyObject *Wiimote_get_acc_cal(Wiimote *self, PyObject *args, PyObject *kwds); static PyObject *Wiimote_get_balance_cal(Wiimote *self); static PyObject *Wiimote_request_status(Wiimote *self); static int Wiimote_set_led(Wiimote *self, PyObject *PyLed, void *closure); static int Wiimote_set_rumble(Wiimote *self, PyObject *PyRumble, void *closure); static int Wiimote_set_rpt_mode(Wiimote *self, PyObject *PyRptMode, void *closure); static PyObject *Wiimote_send_rpt(Wiimote *self, PyObject *args, PyObject *kwds); static PyObject *Wiimote_read(Wiimote *self, PyObject *args, PyObject *kwds); static PyObject *Wiimote_write(Wiimote *self, PyObject *args, PyObject *kwds); /* helper prototypes */ static cwiid_mesg_callback_t CallbackBridge; PyObject *ConvertMesgArray(int mesg_count, union cwiid_mesg mesg[]); static PyMethodDef Wiimote_Methods[] = { {"close", (PyCFunction)Wiimote_close, METH_NOARGS, "close()\n\nClose the Wiimote connection"}, {"enable", (PyCFunction)Wiimote_enable, METH_VARARGS | METH_KEYWORDS, "enable(flags)\n\nenable Wiimote connection flags"}, {"disable", (PyCFunction)Wiimote_disable, METH_VARARGS | METH_KEYWORDS, "disable(flags)\n\ndisable Wiimote connection flags"}, {"get_mesg", (PyCFunction)Wiimote_get_mesg, METH_NOARGS, "get_mesg() -> message list\n\nretrieve message list from queue"}, {"get_acc_cal", (PyCFunction)Wiimote_get_acc_cal, METH_VARARGS | METH_KEYWORDS, "get_acc_cal(extension) -> calibration tuple\n\n" "retrieve accelerometer calibration information"}, {"get_balance_cal", (PyCFunction)Wiimote_get_balance_cal, METH_NOARGS, "get_balance_cal() -> calibration tuple\n\n" "retrieve Balance Board calibration information"}, {"request_status", (PyCFunction)Wiimote_request_status, METH_NOARGS, "request_status()\n\nrequest status message"}, {"read", (PyCFunction)Wiimote_read, METH_VARARGS | METH_KEYWORDS, "read(flags,offset,len) -> buffer\n\nread data from Wiimote"}, {"send_rpt", (PyCFunction)Wiimote_send_rpt, METH_VARARGS | METH_KEYWORDS, "send_rpt(flags,report,buffer)\n\nsend a report to Wiimote"}, {"write", (PyCFunction)Wiimote_write, METH_VARARGS | METH_KEYWORDS, "write(flags,offset,buffer)\n\nwrite data to Wiimote"}, {NULL, NULL, 0, NULL} }; static PyGetSetDef Wiimote_GetSet[] = { {"state", (getter)Wiimote_get_state, NULL, "Wiimote state", NULL}, {"mesg_callback", NULL, (setter)Wiimote_set_mesg_callback, "Wiimote message callback", NULL}, {"led", NULL, (setter)Wiimote_set_led, "Wiimote led state", NULL}, {"rumble", NULL, (setter)Wiimote_set_rumble, "Wiimote rumble state", NULL}, {"rpt_mode", NULL, (setter)Wiimote_set_rpt_mode, "Wiimote report mode", NULL}, {NULL, NULL, NULL, NULL, NULL} }; PyTypeObject Wiimote_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ "cwiid.Wiimote", /* tp_name */ sizeof(Wiimote), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)Wiimote_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ "CWiid Wiimote connection object", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ Wiimote_Methods, /* tp_methods */ 0, /* tp_members */ Wiimote_GetSet, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)Wiimote_init, /* tp_init */ 0, /* tp_alloc */ Wiimote_new, /* tp_new */ }; /* Allocate and deallocate functions */ static PyObject * Wiimote_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { Wiimote* self; if (!(self = (Wiimote *) type->tp_alloc(type, 0))) { return NULL; } self->wiimote = NULL; Py_INCREF(self->callback = Py_None); self->close_on_dealloc = 0; return (PyObject*) self; } static void Wiimote_dealloc(Wiimote *self) { if (self->close_on_dealloc && self->wiimote) { cwiid_close(self->wiimote); } Py_XDECREF(self->callback); self->ob_type->tp_free((PyObject *)self); } static int Wiimote_init(Wiimote* self, PyObject* args, PyObject *kwds) { static char *kwlist[] = {"bdaddr", "flags", NULL}; PyObject *PyObj; cwiid_wiimote_t *wiimote = NULL; char *str_bdaddr = NULL; bdaddr_t bdaddr; int flags = 0; /* Overloaded function - if a single CObject is passed in, it's * an existing CObject. Otherwise, create a new one */ if (PyTuple_Size(args) == 1) { PyObj = PyTuple_GET_ITEM(args, 0); if (PyCObject_Check(PyObj)) { wiimote = PyCObject_AsVoidPtr(PyObj); self->close_on_dealloc = 0; } } if (!wiimote) { if (!PyArg_ParseTupleAndKeywords(args, kwds, "|si:cwiid.Wiimote.init", kwlist, &str_bdaddr, &flags)) { return -1; } if (str_bdaddr) { if (str2ba(str_bdaddr, &bdaddr)) { PyErr_SetString(PyExc_ValueError, "bad bdaddr"); return -1; } } else { bdaddr = *BDADDR_ANY; } Py_BEGIN_ALLOW_THREADS wiimote = cwiid_open(&bdaddr, flags); Py_END_ALLOW_THREADS if (!wiimote) { PyErr_SetString(PyExc_RuntimeError, "Error opening wiimote connection"); return -1; } else { self->close_on_dealloc = 1; } } cwiid_set_data(wiimote, self); self->wiimote = wiimote; return 0; } #define SET_CLOSED_ERROR PyErr_SetString(PyExc_ValueError, "Wiimote is closed") static PyObject *Wiimote_close(Wiimote *self) { if (!self->wiimote) { SET_CLOSED_ERROR; return NULL; } if (cwiid_close(self->wiimote)) { PyErr_SetString(PyExc_RuntimeError, "Error closing wiimote connection"); self->wiimote = NULL; return NULL; } self->wiimote = NULL; Py_RETURN_NONE; } static PyObject *Wiimote_enable(Wiimote *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = {"flags", NULL}; int flags; if (!self->wiimote) { SET_CLOSED_ERROR; return NULL; } if (!PyArg_ParseTupleAndKeywords(args, kwds, "i:cwiid.Wiimote.enable", kwlist, &flags)) { return NULL; } if (cwiid_enable(self->wiimote, flags)) { PyErr_SetString(PyExc_RuntimeError, "Error enabling wiimote flags"); return NULL; } Py_RETURN_NONE; } static PyObject *Wiimote_disable(Wiimote *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = {"flags", NULL}; int flags; if (!self->wiimote) { SET_CLOSED_ERROR; return NULL; } if (!PyArg_ParseTupleAndKeywords(args, kwds, "i:cwiid.Wiimote.disable", kwlist, &flags)) { return NULL; } if (cwiid_disable(self->wiimote, flags)) { PyErr_SetString(PyExc_RuntimeError, "Error disabling wiimote flags"); return NULL; } Py_RETURN_NONE; } static int Wiimote_set_mesg_callback(Wiimote *self, PyObject *NewCallback, void *closure) { PyObject *OldCallback; if (!self->wiimote) { SET_CLOSED_ERROR; return -1; } if (!PyCallable_Check(NewCallback)) { PyErr_SetString(PyExc_TypeError, "callback must be callable!"); } OldCallback = self->callback; if ((OldCallback == Py_None) && (NewCallback != Py_None)) { if (cwiid_set_mesg_callback(self->wiimote, CallbackBridge)) { PyErr_SetString(PyExc_AttributeError, "Error setting wiimote callback"); return -1; } } else if ((OldCallback != Py_None) && (NewCallback == Py_None)) { if (cwiid_set_mesg_callback(self->wiimote, NULL)) { PyErr_SetString(PyExc_AttributeError, "Error clearing wiimote callback"); return -1; } } Py_INCREF(NewCallback); Py_DECREF(OldCallback); self->callback = NewCallback; return 0; } static PyObject *Wiimote_get_mesg(Wiimote *self) { union cwiid_mesg *mesg; int mesg_count; struct timespec t; PyObject *PyMesg; if (!self->wiimote) { SET_CLOSED_ERROR; return NULL; } if (cwiid_get_mesg(self->wiimote, &mesg_count, &mesg, &t)) { if (errno == EAGAIN) { Py_RETURN_NONE; } else { PyErr_SetString(PyExc_RuntimeError, "Error getting wiimote message list"); return NULL; } } PyMesg = ConvertMesgArray(mesg_count, mesg); free(mesg); return PyMesg; } static PyObject *Wiimote_get_state(Wiimote* self, void *closure) { struct cwiid_state state; PyObject *PyState; if (!self->wiimote) { SET_CLOSED_ERROR; return NULL; } if (cwiid_get_state(self->wiimote, &state)) { PyErr_SetString(PyExc_IOError, "get state error"); return NULL; } PyState = Py_BuildValue("{s:B,s:B,s:B,s:B,s:i,s:i}", "rpt_mode", state.rpt_mode, "led", state.led, "rumble", state.rumble, "battery", state.battery, "ext_type", state.ext_type, "error", state.error); if (state.rpt_mode & CWIID_RPT_BTN) { PyObject *PyBtn = Py_BuildValue("I", state.buttons); if (!PyBtn) { Py_DECREF(PyState); return NULL; } if (PyDict_SetItemString(PyState, "buttons", PyBtn)) { Py_DECREF(PyState); Py_DECREF(PyBtn); return NULL; } Py_DECREF(PyBtn); } if (state.rpt_mode & CWIID_RPT_ACC) { PyObject *PyAcc = Py_BuildValue("(B,B,B)", state.acc[CWIID_X], state.acc[CWIID_Y], state.acc[CWIID_Z]); if (!PyAcc) { Py_DECREF(PyState); return NULL; } if (PyDict_SetItemString(PyState, "acc", PyAcc)) { Py_DECREF(PyState); Py_DECREF(PyAcc); return NULL; } Py_DECREF(PyAcc); } if (state.rpt_mode & CWIID_RPT_IR) { int i; PyObject *PyIr = PyList_New(CWIID_IR_SRC_COUNT); if (!PyIr) { Py_DECREF(PyState); return NULL; } if (PyDict_SetItemString(PyState, "ir_src", PyIr)) { Py_DECREF(PyState); Py_DECREF(PyIr); return NULL; } Py_DECREF(PyIr); for (i=0; i < CWIID_IR_SRC_COUNT; i++) { PyObject *PyIrSrc; PyObject *PySize; if (state.ir_src[i].valid) { PyIrSrc = Py_BuildValue("{s:(I,I)}", "pos", state.ir_src[i].pos[CWIID_X], state.ir_src[i].pos[CWIID_Y]); if (!PyIrSrc) { Py_DECREF(PyState); return NULL; } if (state.ir_src[i].size != -1) { if (!(PySize = PyInt_FromLong( (long)state.ir_src[i].size))) { Py_DECREF(PyState); Py_DECREF(PyIrSrc); return NULL; } if (PyDict_SetItemString(PyIrSrc, "size", PySize)) { Py_DECREF(PyState); Py_DECREF(PyIrSrc); Py_DECREF(PySize); return NULL; } Py_DECREF(PySize); } } else { Py_INCREF(PyIrSrc = Py_None); } PyList_SET_ITEM(PyIr, i, PyIrSrc); } } switch (state.ext_type) { PyObject *PyExt; case CWIID_EXT_NUNCHUK: if (state.rpt_mode & CWIID_RPT_NUNCHUK) { PyExt = Py_BuildValue("{s:(B,B),s:(B,B,B),s:I}", "stick", state.ext.nunchuk.stick[CWIID_X], state.ext.nunchuk.stick[CWIID_Y], "acc", state.ext.nunchuk.acc[CWIID_X], state.ext.nunchuk.acc[CWIID_Y], state.ext.nunchuk.acc[CWIID_Z], "buttons", state.ext.nunchuk.buttons); if (!PyExt) { Py_DECREF(PyState); return NULL; } if (PyDict_SetItemString(PyState, "nunchuk", PyExt)) { Py_DECREF(PyState); Py_DECREF(PyExt); return NULL; } Py_DECREF(PyExt); } break; case CWIID_EXT_CLASSIC: if (state.rpt_mode & CWIID_RPT_CLASSIC) { PyExt = Py_BuildValue("{s:(B,B),s:(B,B),s:B,s:B,s:I}", "l_stick", state.ext.classic.l_stick[CWIID_X], state.ext.classic.l_stick[CWIID_Y], "r_stick", state.ext.classic.r_stick[CWIID_X], state.ext.classic.r_stick[CWIID_Y], "l", state.ext.classic.l, "r", state.ext.classic.r, "buttons", state.ext.classic.buttons); if (!PyExt) { Py_DECREF(PyState); return NULL; } if (PyDict_SetItemString(PyState, "classic", PyExt)) { Py_DECREF(PyState); Py_DECREF(PyExt); return NULL; } Py_DECREF(PyExt); } break; case CWIID_EXT_BALANCE: if (state.rpt_mode & CWIID_RPT_BALANCE) { PyExt = Py_BuildValue("{s:I,s:I,s:I,s:I}", "right_top", state.ext.balance.right_top, "right_bottom", state.ext.balance.right_bottom, "left_top", state.ext.balance.left_top, "left_bottom", state.ext.balance.left_bottom); if (!PyExt) { Py_DECREF(PyState); return NULL; } if (PyDict_SetItemString(PyState, "balance", PyExt)) { Py_DECREF(PyState); Py_DECREF(PyExt); return NULL; } Py_DECREF(PyExt); } break; case CWIID_EXT_MOTIONPLUS: if (state.rpt_mode & CWIID_RPT_MOTIONPLUS) { PyExt = Py_BuildValue("{s:(I,I,I)}", "angle_rate", state.ext.motionplus.angle_rate[CWIID_PHI], state.ext.motionplus.angle_rate[CWIID_THETA], state.ext.motionplus.angle_rate[CWIID_PSI]); if (!PyExt) { Py_DECREF(PyState); return NULL; } if (PyDict_SetItemString(PyState, "motionplus", PyExt)) { Py_DECREF(PyState); Py_DECREF(PyExt); return NULL; } Py_DECREF(PyExt); } break; default: break; } return PyState; } static PyObject *Wiimote_get_acc_cal(Wiimote *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = { "ext_type", NULL }; int ext_type; struct acc_cal acc_cal; PyObject *PyAccCal; if (!self->wiimote) { SET_CLOSED_ERROR; return NULL; } if (!PyArg_ParseTupleAndKeywords(args, kwds, "i:cwiid.Wiimote.get_acc_cal", kwlist, &ext_type)) { return NULL; } if (cwiid_get_acc_cal(self->wiimote, ext_type, &acc_cal)) { PyErr_SetString(PyExc_RuntimeError, "Error getting wiimote acc calibration"); return NULL; } if (!(PyAccCal = Py_BuildValue("([i,i,i],[i,i,i])", acc_cal.zero[0], acc_cal.zero[1], acc_cal.zero[2], acc_cal.one[0], acc_cal.one[1], acc_cal.one[2]))) { return NULL; } return PyAccCal; } static PyObject *Wiimote_get_balance_cal(Wiimote *self) { struct balance_cal balance_cal; PyObject *PyBalCal; if (cwiid_get_balance_cal(self->wiimote, &balance_cal)) { PyErr_SetString(PyExc_RuntimeError, "Error getting balance board calibration"); return NULL; } if (!(PyBalCal = Py_BuildValue("([i,i,i],[i,i,i],[i,i,i],[i,i,i])", balance_cal.right_top[0], balance_cal.right_top[1], balance_cal.right_top[2], balance_cal.right_bottom[0], balance_cal.right_bottom[1], balance_cal.right_bottom[2], balance_cal.left_top[0], balance_cal.left_top[1], balance_cal.left_top[2], balance_cal.left_bottom[0], balance_cal.left_bottom[1], balance_cal.left_bottom[2]))) { return NULL; } return PyBalCal; } static PyObject *Wiimote_request_status(Wiimote *self) { if (!self->wiimote) { SET_CLOSED_ERROR; return NULL; } if (cwiid_request_status(self->wiimote)) { PyErr_SetString(PyExc_RuntimeError, "Error requesting wiimote status"); return NULL; } Py_RETURN_NONE; } static int Wiimote_set_led(Wiimote *self, PyObject *PyLed, void *closure) { long led; if (!self->wiimote) { SET_CLOSED_ERROR; return -1; } if (((led = PyInt_AsLong(PyLed)) == -1) && PyErr_Occurred()) { return -1; } if (cwiid_set_led(self->wiimote, (uint8_t)led)) { PyErr_SetString(PyExc_AttributeError, "Error setting wiimote led state"); return -1; } return 0; } static int Wiimote_set_rumble(Wiimote *self, PyObject *PyRumble, void *closure) { long rumble; if (!self->wiimote) { SET_CLOSED_ERROR; return -1; } if (((rumble = PyInt_AsLong(PyRumble)) == -1) && PyErr_Occurred()) { return -1; } if (cwiid_set_rumble(self->wiimote, (uint8_t)rumble)) { PyErr_SetString(PyExc_AttributeError, "Error setting wiimote rumble state"); return -1; } return 0; } static int Wiimote_set_rpt_mode(Wiimote *self, PyObject *PyRptMode, void *closure) { long rpt_mode; if (!self->wiimote) { SET_CLOSED_ERROR; return -1; } if (((rpt_mode = PyInt_AsLong(PyRptMode)) == -1) && PyErr_Occurred()) { return -1; } if (cwiid_set_rpt_mode(self->wiimote, (uint8_t)rpt_mode)) { PyErr_SetString(PyExc_AttributeError, "Error setting wiimote report mode"); return -1; } return 0; } /* static PyObject *Wiimote_command(Wiimote *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = { "command", "flags", NULL }; int command, flags; if (!PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwlist, &command, &flags)) { return NULL; } cwiid_command(self->wiimote, (enum cwiid_command)command, (uint8_t)flags); Py_RETURN_NONE; } */ static PyObject *Wiimote_send_rpt(Wiimote *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = { "flags", "report", "buffer", NULL }; unsigned char flags, report; void *buf; int len; if (!self->wiimote) { SET_CLOSED_ERROR; return NULL; } if (!PyArg_ParseTupleAndKeywords(args, kwds, "BBt#:cwiid.Wiimote.send_rpt", kwlist, &flags, &report, &buf, &len)) { return NULL; } if (cwiid_send_rpt(self->wiimote, flags, report, len, buf)) { PyErr_SetString(PyExc_RuntimeError, "Error sending report"); return NULL; } Py_RETURN_NONE; } static PyObject *Wiimote_read(Wiimote *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = { "flags", "offset", "len", NULL }; unsigned char flags; unsigned int offset; Py_ssize_t len; void *buf; PyObject *pyRetBuf; if (!self->wiimote) { SET_CLOSED_ERROR; return NULL; } if (!PyArg_ParseTupleAndKeywords(args, kwds, "BII:cwiid.Wiimote.read", kwlist, &flags, &offset, &len)) { return NULL; } if (!(pyRetBuf = PyBuffer_New(len))) { return NULL; } if (PyObject_AsWriteBuffer(pyRetBuf, &buf, &len)) { Py_DECREF(pyRetBuf); return NULL; } if (cwiid_read(self->wiimote,flags,offset,len,buf)) { PyErr_SetString(PyExc_RuntimeError, "Error reading wiimote data"); Py_DECREF(pyRetBuf); return NULL; } return pyRetBuf; } static PyObject *Wiimote_write(Wiimote *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = { "flags", "offset", "buffer", NULL }; unsigned char flags; unsigned int offset; void *buf; int len; if (!self->wiimote) { SET_CLOSED_ERROR; return NULL; } if (!PyArg_ParseTupleAndKeywords(args, kwds, "BIt#:cwiid.Wiimote.write", kwlist, &flags, &offset, &buf, &len)) { return NULL; } if (cwiid_write(self->wiimote, flags, offset, len, buf)) { PyErr_SetString(PyExc_RuntimeError, "Error writing wiimote data"); return NULL; } Py_RETURN_NONE; } static void CallbackBridge(cwiid_wiimote_t *wiimote, int mesg_count, union cwiid_mesg mesg[], struct timespec *t) { PyObject *ArgTuple; PyObject *PySelf; PyGILState_STATE gstate; gstate = PyGILState_Ensure(); ArgTuple = ConvertMesgArray(mesg_count, mesg); /* Put id and the list of messages as the arguments to the callback */ PySelf = (PyObject *) cwiid_get_data(wiimote); if (!PyObject_CallFunction(((Wiimote *)PySelf)->callback, "(O, d)", ArgTuple, t->tv_sec + ((double) t->tv_nsec) * 1e-9)) { PyErr_Print(); } Py_XDECREF(ArgTuple); PyGILState_Release(gstate); } /* This is the function responsible for marshaling the cwiid messages from * C to python. It's rather complicated since it uses a complex C union * to store the data and multiple enumerations to figure out what data is * actually being sent. Neither of these common C types really translate * well into Python. I've done my best to translate it to python as follows: * * Python callback takes arg (mesgs). The mesgs is a list of * mesg tuples which contain the mesg type and a dict of the arguments. * * Ex: * mesgs =>[(cwiid.STATUS_MESG,{"battery":battery,"ext_type":ext_type}), * (cwiid.BTN_MESG,buttons), * (cwiid.ACC_MESG,(x,y,z)), * (cwiid.IR_MESG,[{"pos":(x,y),"size":size}, ...]), * (cwiid.NUNCHUK_MESG,{"stick":(x,y),"acc":(x,y,z), * "buttons":buttons}, * (cwiid.CLASSIC_MESG,{"l_stick":(x,y),"r_stick":(x,y),"l":l,"r":r, * "buttons":buttons}, * (cwiid.BALANCE_MESG,{"right_top":right_top, * "right_bottom":right_bottom, * "left_top":left_top, * "left_bottom":left_bottom}, * (cwiid.MOTIONPLUS_MESG,{"angle_rate":(psi,theta,phi)}, * (cwiid.ERROR_MESG,error)] */ PyObject *ConvertMesgArray(int mesg_count, union cwiid_mesg mesg[]) { PyObject *mesglist; /* List of message tuples */ PyObject *amesg; /* A single message (type, [arguments]) */ PyObject *mesgVal; /* Dictionary of arguments for a message */ PyObject *PyIrList; int i, j; if (!(mesglist = PyList_New(mesg_count))) { return NULL; } for (i = 0; i < mesg_count; i++) { switch (mesg[i].type) { case CWIID_MESG_STATUS: mesgVal = Py_BuildValue("{s:B,s:i}", "battery", mesg[i].status_mesg.battery, "ext_type", mesg[i].status_mesg.ext_type); break; case CWIID_MESG_BTN: mesgVal = Py_BuildValue("I", mesg[i].btn_mesg.buttons); break; case CWIID_MESG_ACC: mesgVal = Py_BuildValue("(B,B,B)", mesg[i].acc_mesg.acc[CWIID_X], mesg[i].acc_mesg.acc[CWIID_Y], mesg[i].acc_mesg.acc[CWIID_Z]); break; case CWIID_MESG_IR: mesgVal = NULL; if (!(PyIrList = PyList_New(CWIID_IR_SRC_COUNT))) { break; } for (j=0; j < CWIID_IR_SRC_COUNT; j++) { PyObject *PyIrSrc; PyObject *PySize; if (mesg[i].ir_mesg.src[j].valid) { PyIrSrc = Py_BuildValue("{s:(I,I)}", "pos", mesg[i].ir_mesg.src[j].pos[CWIID_X], mesg[i].ir_mesg.src[j].pos[CWIID_Y]); if (!PyIrSrc) { Py_DECREF(PyIrList); PyIrList = NULL; break; } if (mesg[i].ir_mesg.src[j].size != -1) { if (!(PySize = PyInt_FromLong( (long)mesg[i].ir_mesg.src[j].size))) { Py_DECREF(PyIrList); Py_DECREF(PyIrSrc); PyIrList = NULL; break; } if (PyDict_SetItemString(PyIrSrc, "size", PySize)) { Py_DECREF(PyIrList); Py_DECREF(PyIrSrc); Py_DECREF(PySize); PyIrList = NULL; break; } Py_DECREF(PySize); } } else { Py_INCREF(PyIrSrc = Py_None); } PyList_SET_ITEM(PyIrList, j, PyIrSrc); } if (!PyIrList) { break; } mesgVal = PyIrList; break; case CWIID_MESG_NUNCHUK: mesgVal = Py_BuildValue("{s:(B,B),s:(B,B,B),s:I}", "stick", mesg[i].nunchuk_mesg.stick[CWIID_X], mesg[i].nunchuk_mesg.stick[CWIID_Y], "acc", mesg[i].nunchuk_mesg.acc[CWIID_X], mesg[i].nunchuk_mesg.acc[CWIID_Y], mesg[i].nunchuk_mesg.acc[CWIID_Z], "buttons", mesg[i].nunchuk_mesg.buttons); break; case CWIID_MESG_CLASSIC: mesgVal = Py_BuildValue("{s:(B,B),s:(B,B),s:B,s:B,s:I}", "l_stick", mesg[i].classic_mesg.l_stick[CWIID_X], mesg[i].classic_mesg.l_stick[CWIID_Y], "r_stick", mesg[i].classic_mesg.r_stick[CWIID_X], mesg[i].classic_mesg.r_stick[CWIID_Y], "l", mesg[i].classic_mesg.l, "r", mesg[i].classic_mesg.r, "buttons", mesg[i].classic_mesg.buttons); break; case CWIID_MESG_BALANCE: mesgVal = Py_BuildValue("{s:I,s:I,s:I,s:I}", "right_top", mesg[i].balance_mesg.right_top, "right_bottom", mesg[i].balance_mesg.right_bottom, "left_top", mesg[i].balance_mesg.left_top, "left_bottom", mesg[i].balance_mesg.left_bottom); break; case CWIID_MESG_MOTIONPLUS: mesgVal = Py_BuildValue("{s:(I,I,I)}", "angle_rate", mesg[i].motionplus_mesg.angle_rate[CWIID_PHI], mesg[i].motionplus_mesg.angle_rate[CWIID_THETA], mesg[i].motionplus_mesg.angle_rate[CWIID_PSI]); break; case CWIID_MESG_ERROR: mesgVal = Py_BuildValue("i", mesg[i].error_mesg.error); break; default: Py_INCREF(mesgVal = Py_None); break; } if (!mesgVal) { return NULL; } /* Finally Put the type next to the message in a tuple and * append them to the list of messages */ if (!(amesg = Py_BuildValue("(iO)", mesg[i].type, mesgVal))) { Py_DECREF(mesgVal); return NULL; } Py_DECREF(mesgVal); PyList_SET_ITEM(mesglist, i, amesg); } return mesglist; } cwiid-0.6.00+svn201/python/Makefile.in0000644000175000017500000000103210663422171016407 0ustar tootstoots#Copyright (C) 2007 Justin M. Tulloss include @top_builddir@/defs.mak ifdef ROOTDIR SET_ROOT_DIR = "--root=$(ROOTDIR)" endif all: $(PYTHON) setup.py build_ext $(DEBUGFLAGS) -I@top_builddir@/libcwiid -L@top_builddir@/libcwiid -lcwiid install: $(PYTHON) setup.py install --install-lib=${libdir}/python@PYTHON_VERSION@/site-packages $(SET_ROOT_DIR) uninstall: rm -f $(ROOTDIR)${libdir}/python@PYTHON_VERSION@/site-packages/cwiid.so clean: rm -rf build distclean: clean rm Makefile .PHONY: all install uninstall clean distclean cwiid-0.6.00+svn201/python/cwiidmodule.c0000644000175000017500000001443011223453733017022 0ustar tootstoots/* * Copyright (C) 2007 Justin M. Tulloss * * Interface from Python to libcwiid * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA * * ChangeLog: * 2007-06-05 L. Donnie Smith * * removed Wiimote_FromC function * * 2007-06-01 L. Donnie Smith * * added CObjects for Wiimote_FromC and ConvertMesgArray * * 2007-05-22 L. Donnie Smith * * clarified variable names * * 2007-05-14 L. Donnie Smith * * moved Wiimote class to separate files * * 2007-05-12 L. Donnie Smith * * added keywords to read * * finished get_mesg * * cleaned up types in get_state * * finished processMesgs * * 2007-05-09 L. Donnie Smith * * finished get_state * * fixed read buffer issue * * implemented write * * cleaned up types * * removed notImplemented (no longer needed) * * 2007-05-07 L. Donnie Smith * * C-style comments * * changed struct name to Wiimote * * removed dlopen, unused includes * * spaces to tabs, misc stylistic changes to match CWiid code * * changed self types to Wiimote * * made bdaddr local * * improved error checking in Wiimote_init * * implemented disconnect, enable, disable * * partially implemented get_state * * 2007-05-07 Justin M. Tulloss * * Refactored according to dsmith's wishes, removed unnecessary locks * * implemented read * * 2007-04-26 Justin M. Tulloss * * Updated for new libcwiid API * * 2007-04-24 Justin M. Tulloss * * Initial Changelog */ #include "Python.h" #include #include "cwiid.h" #include "structmember.h" /* externally defined types */ extern PyTypeObject Wiimote_Type; extern PyObject *ConvertMesgArray(int, union cwiid_mesg []); /* cwiid module initializer */ PyMODINIT_FUNC initcwiid(void); /* constants, enumerations */ #define CWIID_CONST_MACRO(a) {#a, CWIID_##a} static struct { char *name; int value; } cwiid_constants[] = { CWIID_CONST_MACRO(FLAG_MESG_IFC), CWIID_CONST_MACRO(FLAG_CONTINUOUS), CWIID_CONST_MACRO(FLAG_REPEAT_BTN), CWIID_CONST_MACRO(FLAG_NONBLOCK), CWIID_CONST_MACRO(FLAG_MOTIONPLUS), CWIID_CONST_MACRO(RPT_STATUS), CWIID_CONST_MACRO(RPT_BTN), CWIID_CONST_MACRO(RPT_ACC), CWIID_CONST_MACRO(RPT_IR), CWIID_CONST_MACRO(RPT_NUNCHUK), CWIID_CONST_MACRO(RPT_CLASSIC), CWIID_CONST_MACRO(RPT_BALANCE), CWIID_CONST_MACRO(RPT_MOTIONPLUS), CWIID_CONST_MACRO(RPT_EXT), CWIID_CONST_MACRO(LED1_ON), CWIID_CONST_MACRO(LED2_ON), CWIID_CONST_MACRO(LED3_ON), CWIID_CONST_MACRO(LED4_ON), CWIID_CONST_MACRO(BTN_2), CWIID_CONST_MACRO(BTN_1), CWIID_CONST_MACRO(BTN_B), CWIID_CONST_MACRO(BTN_A), CWIID_CONST_MACRO(BTN_MINUS), CWIID_CONST_MACRO(BTN_HOME), CWIID_CONST_MACRO(BTN_LEFT), CWIID_CONST_MACRO(BTN_RIGHT), CWIID_CONST_MACRO(BTN_DOWN), CWIID_CONST_MACRO(BTN_UP), CWIID_CONST_MACRO(BTN_PLUS), CWIID_CONST_MACRO(NUNCHUK_BTN_Z), CWIID_CONST_MACRO(NUNCHUK_BTN_C), CWIID_CONST_MACRO(CLASSIC_BTN_UP), CWIID_CONST_MACRO(CLASSIC_BTN_LEFT), CWIID_CONST_MACRO(CLASSIC_BTN_ZR), CWIID_CONST_MACRO(CLASSIC_BTN_X), CWIID_CONST_MACRO(CLASSIC_BTN_A), CWIID_CONST_MACRO(CLASSIC_BTN_Y), CWIID_CONST_MACRO(CLASSIC_BTN_B), CWIID_CONST_MACRO(CLASSIC_BTN_ZL), CWIID_CONST_MACRO(CLASSIC_BTN_R), CWIID_CONST_MACRO(CLASSIC_BTN_PLUS), CWIID_CONST_MACRO(CLASSIC_BTN_HOME), CWIID_CONST_MACRO(CLASSIC_BTN_MINUS), CWIID_CONST_MACRO(CLASSIC_BTN_L), CWIID_CONST_MACRO(CLASSIC_BTN_DOWN), CWIID_CONST_MACRO(CLASSIC_BTN_RIGHT), CWIID_CONST_MACRO(SEND_RPT_NO_RUMBLE), CWIID_CONST_MACRO(RW_EEPROM), CWIID_CONST_MACRO(RW_REG), CWIID_CONST_MACRO(RW_DECODE), CWIID_CONST_MACRO(MAX_READ_LEN), CWIID_CONST_MACRO(X), CWIID_CONST_MACRO(Y), CWIID_CONST_MACRO(Z), CWIID_CONST_MACRO(PHI), CWIID_CONST_MACRO(THETA), CWIID_CONST_MACRO(PSI), CWIID_CONST_MACRO(IR_SRC_COUNT), CWIID_CONST_MACRO(IR_X_MAX), CWIID_CONST_MACRO(IR_Y_MAX), CWIID_CONST_MACRO(BATTERY_MAX), CWIID_CONST_MACRO(CLASSIC_L_STICK_MAX), CWIID_CONST_MACRO(CLASSIC_R_STICK_MAX), CWIID_CONST_MACRO(CLASSIC_LR_MAX), CWIID_CONST_MACRO(CMD_STATUS), CWIID_CONST_MACRO(CMD_LED), CWIID_CONST_MACRO(CMD_RUMBLE), CWIID_CONST_MACRO(CMD_RPT_MODE), CWIID_CONST_MACRO(MESG_STATUS), CWIID_CONST_MACRO(MESG_BTN), CWIID_CONST_MACRO(MESG_ACC), CWIID_CONST_MACRO(MESG_IR), CWIID_CONST_MACRO(MESG_NUNCHUK), CWIID_CONST_MACRO(MESG_CLASSIC), CWIID_CONST_MACRO(MESG_BALANCE), CWIID_CONST_MACRO(MESG_MOTIONPLUS), CWIID_CONST_MACRO(MESG_ERROR), CWIID_CONST_MACRO(MESG_UNKNOWN), CWIID_CONST_MACRO(EXT_NONE), CWIID_CONST_MACRO(EXT_NUNCHUK), CWIID_CONST_MACRO(EXT_CLASSIC), CWIID_CONST_MACRO(EXT_BALANCE), CWIID_CONST_MACRO(EXT_MOTIONPLUS), CWIID_CONST_MACRO(EXT_UNKNOWN), CWIID_CONST_MACRO(ERROR_DISCONNECT), CWIID_CONST_MACRO(ERROR_COMM), {NULL, 0} }; /* Associates cwiid functions with python ones */ static PyMethodDef Module_Methods[] = { {NULL, NULL, 0, NULL} }; PyMODINIT_FUNC initcwiid(void) { PyObject *Module; PyObject *CObj; int i; PyEval_InitThreads(); if (PyType_Ready(&Wiimote_Type) < 0) { return; } if (!(Module = Py_InitModule3("cwiid", Module_Methods, "CWiid Wiimote Interface"))) { return; } Py_INCREF(&Wiimote_Type); PyModule_AddObject(Module, "Wiimote", (PyObject*)&Wiimote_Type); for (i = 0; cwiid_constants[i].name; i++) { /* No way to report errors from here, so just ignore them and hope * for segfault */ PyModule_AddIntConstant(Module, cwiid_constants[i].name, cwiid_constants[i].value); } if (!(CObj = PyCObject_FromVoidPtr(ConvertMesgArray, NULL))) { return; } PyModule_AddObject(Module, "ConvertMesgArray", CObj); } cwiid-0.6.00+svn201/python/setup.py0000644000175000017500000000023110634140413016046 0ustar tootstootsfrom distutils.core import setup, Extension setup(name='cwiid', version='0.6.00', ext_modules=[Extension('cwiid', ['cwiidmodule.c', 'Wiimote.c'])] ) cwiid-0.6.00+svn201/defs.mak.in0000644000175000017500000000132110652707447015054 0ustar tootstoots#Copyright (C) 2007 L. Donnie Smith PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ prefix = @prefix@ exec_prefix = @exec_prefix@ sysconfdir = @sysconfdir@ libdir = @libdir@ datarootdir = @datarootdir@ mandir = @mandir@ docdir = @docdir@ CC = @CC@ AWK = @AWK@ LEX = @LEX@ YACC = @YACC@ PYTHON = @PYTHON@ COMMON = @abs_top_builddir@/common ifdef DESTDIR ROOTDIR = $(DESTDIR:%/=%) endif CWIID_CONFIG_DIR = $(ROOTDIR)@CWIID_CONFIG_DIR@ CWIID_PLUGINS_DIR = $(ROOTDIR)@CWIID_PLUGINS_DIR@ DEBUGFLAGS = -g WARNFLAGS = -Wall -W CFLAGS = $(DEBUGFLAGS) $(WARNFLAGS) @DEFS@ -I$(COMMON)/include cwiid-0.6.00+svn201/AUTHORS0000644000175000017500000000005010573132204014063 0ustar tootstootsL. Donnie Smith cwiid-0.6.00+svn201/wmdemo/0000755000175000017500000000000011260043516014311 5ustar tootstootscwiid-0.6.00+svn201/wmdemo/wmdemo.py0000755000175000017500000001411411223453733016164 0ustar tootstoots#!/usr/bin/python import cwiid import sys menu = '''1: toggle LED 1 2: toggle LED 2 3: toggle LED 3 4: toggle LED 4 5: toggle rumble a: toggle accelerometer reporting b: toggle button reporting c: enable motionplus, if connected e: toggle extension reporting i: toggle ir reporting m: toggle messages p: print this menu r: request status message ((t) enables callback output) s: print current state t: toggle status reporting x: exit''' def main(): led = 0 rpt_mode = 0 rumble = 0 mesg = False #Connect to address given on command-line, if present print 'Put Wiimote in discoverable mode now (press 1+2)...' global wiimote if len(sys.argv) > 1: wiimote = cwiid.Wiimote(sys.argv[1]) else: wiimote = cwiid.Wiimote() wiimote.mesg_callback = callback print menu exit = 0 while not exit: c = sys.stdin.read(1) if c == '1': led ^= cwiid.LED1_ON wiimote.led = led elif c == '2': led ^= cwiid.LED2_ON wiimote.led = led elif c == '3': led ^= cwiid.LED3_ON wiimote.led = led elif c == '4': led ^= cwiid.LED4_ON wiimote.led = led elif c == '5': rumble ^= 1 wiimote.rumble = rumble elif c == 'a': rpt_mode ^= cwiid.RPT_ACC wiimote.rpt_mode = rpt_mode elif c == 'b': rpt_mode ^= cwiid.RPT_BTN wiimote.rpt_mode = rpt_mode elif c == 'c': wiimote.enable(cwiid.FLAG_MOTIONPLUS) elif c == 'e': rpt_mode ^= cwiid.RPT_EXT wiimote.rpt_mode = rpt_mode elif c == 'i': rpt_mode ^= cwiid.RPT_IR wiimote.rpt_mode = rpt_mode elif c == 'm': mesg = not mesg if mesg: wiimote.enable(cwiid.FLAG_MESG_IFC); else: wiimote.disable(cwiid.FLAG_MESG_IFC); elif c == 'p': print menu elif c == 'r': wiimote.request_status() elif c == 's': print_state(wiimote.state) elif c == 't': rpt_mode ^= cwiid.RPT_STATUS wiimote.rpt_mode = rpt_mode elif c == 'x': exit = -1; elif c == '\n': pass else: print 'invalid option' wiimote.close() def print_state(state): print 'Report Mode:', for r in ['STATUS', 'BTN', 'ACC', 'IR', 'NUNCHUK', 'CLASSIC', 'BALANCE', 'MOTIONPLUS']: if state['rpt_mode'] & eval('cwiid.RPT_' + r): print r, print print 'Active LEDs:', for led in ['1','2','3','4']: if state['led'] & eval('cwiid.LED' + led + '_ON'): print led, print print 'Rumble:', state['rumble'] and 'On' or 'Off' print 'Battery:', int(100.0 * state['battery'] / cwiid.BATTERY_MAX) if 'buttons' in state: print 'Buttons:', state['buttons'] if 'acc' in state: print 'Acc: x=%d y=%d z=%d' % (state['acc'][cwiid.X], state['acc'][cwiid.Y], state['acc'][cwiid.Z]) if 'ir_src' in state: valid_src = False print 'IR:', for src in state['ir_src']: if src: valid_src = True print src['pos'], if not valid_src: print 'no sources detected' else: print if state['ext_type'] == cwiid.EXT_NONE: print 'No extension' elif state['ext_type'] == cwiid.EXT_UNKNOWN: print 'Unknown extension attached' elif state['ext_type'] == cwiid.EXT_NUNCHUK: if state.has_key('nunchuk'): print 'Nunchuk: btns=%.2X stick=%r acc.x=%d acc.y=%d acc.z=%d' % \ (state['nunchuk']['buttons'], state['nunchuk']['stick'], state['nunchuk']['acc'][cwiid.X], state['nunchuk']['acc'][cwiid.Y], state['nunchuk']['acc'][cwiid.Z]) elif state['ext_type'] == cwiid.EXT_CLASSIC: if state.has_key('classic'): print 'Classic: btns=%.4X l_stick=%r r_stick=%r l=%d r=%d' % \ (state['classic']['buttons'], state['classic']['l_stick'], state['classic']['r_stick'], state['classic']['l'], state['classic']['r']) elif state['ext_type'] == cwiid.EXT_BALANCE: if state.has_key('balance'): print 'Balance: right_top=%d right_bottom=%d left_top=%d left_bottom=%d' % \ (state['balance']['right_top'], state['balance']['right_bottom'], state['balance']['left_top'], state['balance']['left_bottom']) elif state['ext_type'] == cwiid.EXT_MOTIONPLUS: if state.has_key('motionplus'): print 'MotionPlus: angle_rate=(%d,%d,%d)' % state['motionplus']['angle_rate'] def callback(mesg_list, time): print 'time: %f' % time for mesg in mesg_list: if mesg[0] == cwiid.MESG_STATUS: print 'Status Report: battery=%d extension=' % \ mesg[1]['battery'], if mesg[1]['ext_type'] == cwiid.EXT_NONE: print 'none' elif mesg[1]['ext_type'] == cwiid.EXT_NUNCHUK: print 'Nunchuk' elif mesg[1]['ext_type'] == cwiid.EXT_CLASSIC: print 'Classic Controller' elif mesg[1]['ext_type'] == cwiid.EXT_BALANCE: print 'Balance Board' elif mesg[1]['ext_type'] == cwiid.EXT_MOTIONPLUS: print 'MotionPlus' else: print 'Unknown Extension' elif mesg[0] == cwiid.MESG_BTN: print 'Button Report: %.4X' % mesg[1] elif mesg[0] == cwiid.MESG_ACC: print 'Acc Report: x=%d, y=%d, z=%d' % \ (mesg[1][cwiid.X], mesg[1][cwiid.Y], mesg[1][cwiid.Z]) elif mesg[0] == cwiid.MESG_IR: valid_src = False print 'IR Report: ', for src in mesg[1]: if src: valid_src = True print src['pos'], if not valid_src: print 'no sources detected' else: print elif mesg[0] == cwiid.MESG_NUNCHUK: print ('Nunchuk Report: btns=%.2X stick=%r ' + \ 'acc.x=%d acc.y=%d acc.z=%d') % \ (mesg[1]['buttons'], mesg[1]['stick'], mesg[1]['acc'][cwiid.X], mesg[1]['acc'][cwiid.Y], mesg[1]['acc'][cwiid.Z]) elif mesg[0] == cwiid.MESG_CLASSIC: print ('Classic Report: btns=%.4X l_stick=%r ' + \ 'r_stick=%r l=%d r=%d') % \ (mesg[1]['buttons'], mesg[1]['l_stick'], mesg[1]['r_stick'], mesg[1]['l'], mesg[1]['r']) elif mesg[0] == cwiid.MESG_BALANCE: print ('Balance Report: right_top=%d right_bottom=%d ' + \ 'left_top=%d left_bottom=%d') % \ (mesg[1]['right_top'], mesg[1]['right_bottom'], mesg[1]['left_top'], mesg[1]['left_bottom']) elif mesg[0] == cwiid.MESG_MOTIONPLUS: print 'MotionPlus Report: angle_rate=(%d,%d,%d)' % \ mesg[1]['angle_rate'] elif mesg[0] == cwiid.MESG_ERROR: print "Error message received" global wiimote wiimote.close() exit(-1) else: print 'Unknown Report' main() cwiid-0.6.00+svn201/wmdemo/wmdemo.c0000644000175000017500000002736511223453733015767 0ustar tootstoots#include #include #include #include /* This is a sample program written to demonstrate basic CWiid libwiimote * usage, until _actual_ documentation can be written. It's quick and dirty * has a horrible interface, but it's sparce enough to pick out the important * parts easily. For examples of read and write code, see wmgui. Speaker * support is "experimental" (read: bad) enough to be disabled. The beginnings * of a speaker output function are in libwiimote source. */ /* Note: accelerometer (including nunchuk) and IR outputs produce a * lot of data - the purpose of this program is demonstration, not good * interface, and it shows. */ cwiid_mesg_callback_t cwiid_callback; #define toggle_bit(bf,b) \ (bf) = ((bf) & b) \ ? ((bf) & ~(b)) \ : ((bf) | (b)) #define MENU \ "1: toggle LED 1\n" \ "2: toggle LED 2\n" \ "3: toggle LED 3\n" \ "4: toggle LED 4\n" \ "5: toggle rumble\n" \ "a: toggle accelerometer reporting\n" \ "b: toggle button reporting\n" \ "c: enable motionplus, if connected\n" \ "e: toggle extension reporting\n" \ "i: toggle ir reporting\n" \ "m: toggle messages\n" \ "p: print this menu\n" \ "r: request status message ((t) enables callback output)\n" \ "s: print current state\n" \ "t: toggle status reporting\n" \ "x: exit\n" void set_led_state(cwiid_wiimote_t *wiimote, unsigned char led_state); void set_rpt_mode(cwiid_wiimote_t *wiimote, unsigned char rpt_mode); void print_state(struct cwiid_state *state); cwiid_err_t err; void err(cwiid_wiimote_t *wiimote, const char *s, va_list ap) { if (wiimote) printf("%d:", cwiid_get_id(wiimote)); else printf("-1:"); vprintf(s, ap); printf("\n"); } int main(int argc, char *argv[]) { cwiid_wiimote_t *wiimote; /* wiimote handle */ struct cwiid_state state; /* wiimote state */ bdaddr_t bdaddr; /* bluetooth device address */ unsigned char mesg = 0; unsigned char led_state = 0; unsigned char rpt_mode = 0; unsigned char rumble = 0; int exit = 0; cwiid_set_err(err); /* Connect to address given on command-line, if present */ if (argc > 1) { str2ba(argv[1], &bdaddr); } else { bdaddr = *BDADDR_ANY; } /* Connect to the wiimote */ printf("Put Wiimote in discoverable mode now (press 1+2)...\n"); if (!(wiimote = cwiid_open(&bdaddr, 0))) { fprintf(stderr, "Unable to connect to wiimote\n"); return -1; } if (cwiid_set_mesg_callback(wiimote, cwiid_callback)) { fprintf(stderr, "Unable to set message callback\n"); } printf("Note: To demonstrate the new API interfaces, wmdemo no longer " "enables messages by default.\n" "Output can be gathered through the new state-based interface (s), " "or by enabling the messages interface (m).\n"); /* Menu */ printf("%s", MENU); while (!exit) { switch (getchar()) { case '1': toggle_bit(led_state, CWIID_LED1_ON); set_led_state(wiimote, led_state); break; case '2': toggle_bit(led_state, CWIID_LED2_ON); set_led_state(wiimote, led_state); break; case '3': toggle_bit(led_state, CWIID_LED3_ON); set_led_state(wiimote, led_state); break; case '4': toggle_bit(led_state, CWIID_LED4_ON); set_led_state(wiimote, led_state); break; case '5': toggle_bit(rumble, 1); if (cwiid_set_rumble(wiimote, rumble)) { fprintf(stderr, "Error setting rumble\n"); } break; case 'a': toggle_bit(rpt_mode, CWIID_RPT_ACC); set_rpt_mode(wiimote, rpt_mode); break; case 'b': toggle_bit(rpt_mode, CWIID_RPT_BTN); set_rpt_mode(wiimote, rpt_mode); break; case 'c': cwiid_enable(wiimote, CWIID_FLAG_MOTIONPLUS); break; case 'e': /* CWIID_RPT_EXT is actually * CWIID_RPT_NUNCHUK | CWIID_RPT_CLASSIC | CWIID_RPT_BALANCE */ toggle_bit(rpt_mode, CWIID_RPT_EXT); set_rpt_mode(wiimote, rpt_mode); break; case 'i': /* libwiimote picks the highest quality IR mode available with the * other options selected (not including as-yet-undeciphered * interleaved mode */ toggle_bit(rpt_mode, CWIID_RPT_IR); set_rpt_mode(wiimote, rpt_mode); break; case 'm': if (!mesg) { if (cwiid_enable(wiimote, CWIID_FLAG_MESG_IFC)) { fprintf(stderr, "Error enabling messages\n"); } else { mesg = 1; } } else { if (cwiid_disable(wiimote, CWIID_FLAG_MESG_IFC)) { fprintf(stderr, "Error disabling message\n"); } else { mesg = 0; } } break; case 'p': printf("%s", MENU); break; case 'r': if (cwiid_request_status(wiimote)) { fprintf(stderr, "Error requesting status message\n"); } break; case 's': if (cwiid_get_state(wiimote, &state)) { fprintf(stderr, "Error getting state\n"); } print_state(&state); break; case 't': toggle_bit(rpt_mode, CWIID_RPT_STATUS); set_rpt_mode(wiimote, rpt_mode); break; case 'x': exit = -1; break; case '\n': break; default: fprintf(stderr, "invalid option\n"); } } if (cwiid_close(wiimote)) { fprintf(stderr, "Error on wiimote disconnect\n"); return -1; } return 0; } void set_led_state(cwiid_wiimote_t *wiimote, unsigned char led_state) { if (cwiid_set_led(wiimote, led_state)) { fprintf(stderr, "Error setting LEDs \n"); } } void set_rpt_mode(cwiid_wiimote_t *wiimote, unsigned char rpt_mode) { if (cwiid_set_rpt_mode(wiimote, rpt_mode)) { fprintf(stderr, "Error setting report mode\n"); } } void print_state(struct cwiid_state *state) { int i; int valid_source = 0; printf("Report Mode:"); if (state->rpt_mode & CWIID_RPT_STATUS) printf(" STATUS"); if (state->rpt_mode & CWIID_RPT_BTN) printf(" BTN"); if (state->rpt_mode & CWIID_RPT_ACC) printf(" ACC"); if (state->rpt_mode & CWIID_RPT_IR) printf(" IR"); if (state->rpt_mode & CWIID_RPT_NUNCHUK) printf(" NUNCHUK"); if (state->rpt_mode & CWIID_RPT_CLASSIC) printf(" CLASSIC"); if (state->rpt_mode & CWIID_RPT_BALANCE) printf(" BALANCE"); if (state->rpt_mode & CWIID_RPT_MOTIONPLUS) printf(" MOTIONPLUS"); printf("\n"); printf("Active LEDs:"); if (state->led & CWIID_LED1_ON) printf(" 1"); if (state->led & CWIID_LED2_ON) printf(" 2"); if (state->led & CWIID_LED3_ON) printf(" 3"); if (state->led & CWIID_LED4_ON) printf(" 4"); printf("\n"); printf("Rumble: %s\n", state->rumble ? "On" : "Off"); printf("Battery: %d%%\n", (int)(100.0 * state->battery / CWIID_BATTERY_MAX)); printf("Buttons: %X\n", state->buttons); printf("Acc: x=%d y=%d z=%d\n", state->acc[CWIID_X], state->acc[CWIID_Y], state->acc[CWIID_Z]); printf("IR: "); for (i = 0; i < CWIID_IR_SRC_COUNT; i++) { if (state->ir_src[i].valid) { valid_source = 1; printf("(%d,%d) ", state->ir_src[i].pos[CWIID_X], state->ir_src[i].pos[CWIID_Y]); } } if (!valid_source) { printf("no sources detected"); } printf("\n"); switch (state->ext_type) { case CWIID_EXT_NONE: printf("No extension\n"); break; case CWIID_EXT_UNKNOWN: printf("Unknown extension attached\n"); break; case CWIID_EXT_NUNCHUK: printf("Nunchuk: btns=%.2X stick=(%d,%d) acc.x=%d acc.y=%d " "acc.z=%d\n", state->ext.nunchuk.buttons, state->ext.nunchuk.stick[CWIID_X], state->ext.nunchuk.stick[CWIID_Y], state->ext.nunchuk.acc[CWIID_X], state->ext.nunchuk.acc[CWIID_Y], state->ext.nunchuk.acc[CWIID_Z]); break; case CWIID_EXT_CLASSIC: printf("Classic: btns=%.4X l_stick=(%d,%d) r_stick=(%d,%d) " "l=%d r=%d\n", state->ext.classic.buttons, state->ext.classic.l_stick[CWIID_X], state->ext.classic.l_stick[CWIID_Y], state->ext.classic.r_stick[CWIID_X], state->ext.classic.r_stick[CWIID_Y], state->ext.classic.l, state->ext.classic.r); break; case CWIID_EXT_BALANCE: printf("Balance: right_top=%d right_bottom=%d " "left_top=%d left_bottom=%d\n", state->ext.balance.right_top, state->ext.balance.right_bottom, state->ext.balance.left_top, state->ext.balance.left_bottom); break; case CWIID_EXT_MOTIONPLUS: printf("MotionPlus: angle_rate=(%d,%d,%d)\n", state->ext.motionplus.angle_rate[0], state->ext.motionplus.angle_rate[1], state->ext.motionplus.angle_rate[2]); break; } } /* Prototype cwiid_callback with cwiid_callback_t, define it with the actual * type - this will cause a compile error (rather than some undefined bizarre * behavior) if cwiid_callback_t changes */ /* cwiid_mesg_callback_t has undergone a few changes lately, hopefully this * will be the last. Some programs need to know which messages were received * simultaneously (e.g. for correlating accelerometer and IR data), and the * sequence number mechanism used previously proved cumbersome, so we just * pass an array of messages, all of which were received at the same time. * The id is to distinguish between multiple wiimotes using the same callback. * */ void cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, union cwiid_mesg mesg[], struct timespec *timestamp) { int i, j; int valid_source; for (i=0; i < mesg_count; i++) { switch (mesg[i].type) { case CWIID_MESG_STATUS: printf("Status Report: battery=%d extension=", mesg[i].status_mesg.battery); switch (mesg[i].status_mesg.ext_type) { case CWIID_EXT_NONE: printf("none"); break; case CWIID_EXT_NUNCHUK: printf("Nunchuk"); break; case CWIID_EXT_CLASSIC: printf("Classic Controller"); break; case CWIID_EXT_BALANCE: printf("Balance Board"); break; case CWIID_EXT_MOTIONPLUS: printf("MotionPlus"); break; default: printf("Unknown Extension"); break; } printf("\n"); break; case CWIID_MESG_BTN: printf("Button Report: %.4X\n", mesg[i].btn_mesg.buttons); break; case CWIID_MESG_ACC: printf("Acc Report: x=%d, y=%d, z=%d\n", mesg[i].acc_mesg.acc[CWIID_X], mesg[i].acc_mesg.acc[CWIID_Y], mesg[i].acc_mesg.acc[CWIID_Z]); break; case CWIID_MESG_IR: printf("IR Report: "); valid_source = 0; for (j = 0; j < CWIID_IR_SRC_COUNT; j++) { if (mesg[i].ir_mesg.src[j].valid) { valid_source = 1; printf("(%d,%d) ", mesg[i].ir_mesg.src[j].pos[CWIID_X], mesg[i].ir_mesg.src[j].pos[CWIID_Y]); } } if (!valid_source) { printf("no sources detected"); } printf("\n"); break; case CWIID_MESG_NUNCHUK: printf("Nunchuk Report: btns=%.2X stick=(%d,%d) acc.x=%d acc.y=%d " "acc.z=%d\n", mesg[i].nunchuk_mesg.buttons, mesg[i].nunchuk_mesg.stick[CWIID_X], mesg[i].nunchuk_mesg.stick[CWIID_Y], mesg[i].nunchuk_mesg.acc[CWIID_X], mesg[i].nunchuk_mesg.acc[CWIID_Y], mesg[i].nunchuk_mesg.acc[CWIID_Z]); break; case CWIID_MESG_CLASSIC: printf("Classic Report: btns=%.4X l_stick=(%d,%d) r_stick=(%d,%d) " "l=%d r=%d\n", mesg[i].classic_mesg.buttons, mesg[i].classic_mesg.l_stick[CWIID_X], mesg[i].classic_mesg.l_stick[CWIID_Y], mesg[i].classic_mesg.r_stick[CWIID_X], mesg[i].classic_mesg.r_stick[CWIID_Y], mesg[i].classic_mesg.l, mesg[i].classic_mesg.r); break; case CWIID_MESG_BALANCE: printf("Balance Report: right_top=%d right_bottom=%d " "left_top=%d left_bottom=%d\n", mesg[i].balance_mesg.right_top, mesg[i].balance_mesg.right_bottom, mesg[i].balance_mesg.left_top, mesg[i].balance_mesg.left_bottom); break; case CWIID_MESG_MOTIONPLUS: printf("MotionPlus Report: angle_rate=(%d,%d,%d)\n", mesg[i].motionplus_mesg.angle_rate[0], mesg[i].motionplus_mesg.angle_rate[1], mesg[i].motionplus_mesg.angle_rate[2]); break; case CWIID_MESG_ERROR: if (cwiid_close(wiimote)) { fprintf(stderr, "Error on wiimote disconnect\n"); exit(-1); } exit(0); break; default: printf("Unknown Report"); break; } } } cwiid-0.6.00+svn201/wmdemo/Makefile.in0000644000175000017500000000046110607047227016366 0ustar tootstoots#Copyright (C) 2007 L. Donnie Smith include @top_builddir@/defs.mak APP_NAME = wmdemo SOURCES = wmdemo.c CFLAGS += -I@top_builddir@/libcwiid LDFLAGS += -L@top_builddir@/libcwiid LDLIBS += -lcwiid INST_DIR = @bindir@ include $(COMMON)/include/app.mak distclean: clean rm Makefile .PHONY: distclean cwiid-0.6.00+svn201/libcwiid/0000755000175000017500000000000011260043516014607 5ustar tootstootscwiid-0.6.00+svn201/libcwiid/interface.c0000644000175000017500000001367011223453733016727 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2007-05-14 L. Donnie Smith * * added timestamp to cwiid_get_mesg * * added cwiid_get_acc_cal * * 2007-04-24 L. Donnie Smith * * created for API overhaul */ #include #include #include #include #include #include #include "cwiid_internal.h" int cwiid_get_id(cwiid_wiimote_t *wiimote) { return wiimote->id; } int cwiid_set_data(cwiid_wiimote_t *wiimote, const void *data) { wiimote->data = data; return 0; } const void *cwiid_get_data(cwiid_wiimote_t *wiimote) { return wiimote->data; } int cwiid_enable(cwiid_wiimote_t *wiimote, int flags) { unsigned char data; if ((flags & CWIID_FLAG_NONBLOCK) && !(wiimote->flags & CWIID_FLAG_NONBLOCK)) { if (fcntl(wiimote->mesg_pipe[0], F_SETFL, O_NONBLOCK)) { cwiid_err(wiimote, "File control error (mesg pipe)"); return -1; } } if (flags & CWIID_FLAG_MOTIONPLUS) { data = 0x04; cwiid_write(wiimote, CWIID_RW_REG, 0xA600FE, 1, &data); cwiid_request_status(wiimote); } wiimote->flags |= flags; return 0; } int cwiid_disable(cwiid_wiimote_t *wiimote, int flags) { unsigned char data; if ((flags & CWIID_FLAG_NONBLOCK) && (wiimote->flags & CWIID_FLAG_NONBLOCK)) { if (fcntl(wiimote->mesg_pipe[0], F_SETFL, 0)) { cwiid_err(wiimote, "File control error (mesg pipe)"); return -1; } } if (flags & CWIID_FLAG_MOTIONPLUS) { data = 0x55; cwiid_write(wiimote, CWIID_RW_REG, 0xA400F0, 1, &data); data = 0x00; cwiid_write(wiimote, CWIID_RW_REG, 0xA400FB, 1, &data); cwiid_request_status(wiimote); } wiimote->flags &= ~flags; return 0; } int cwiid_set_mesg_callback(cwiid_wiimote_t *wiimote, cwiid_mesg_callback_t *callback) { if (wiimote->mesg_callback) { if (cancel_mesg_callback(wiimote)) { /* prints it's own errors */ return -1; } } wiimote->mesg_callback = callback; if (wiimote->mesg_callback) { if (pthread_create(&wiimote->mesg_callback_thread, NULL, (void *(*)(void *))&mesg_callback_thread, wiimote)) { cwiid_err(wiimote, "Thread creation error (callback thread)"); return -1; } } return 0; } int cwiid_get_mesg(cwiid_wiimote_t *wiimote, int *mesg_count, union cwiid_mesg *mesg[], struct timespec *timestamp) { struct mesg_array ma; if (read_mesg_array(wiimote->mesg_pipe[0], &ma)) { if (errno == EAGAIN) { return -1; } else { cwiid_err(wiimote, "Pipe read error (mesg_pipe)"); return -1; } } *mesg_count = ma.count; *timestamp = ma.timestamp; if ((*mesg = malloc(ma.count * sizeof ma.array[0])) == NULL) { cwiid_err(wiimote, "Memory allocation error (mesg array)"); return -1; } memcpy(*mesg, &ma.array, ma.count * sizeof (*mesg)[0]); return 0; } int cwiid_get_state(cwiid_wiimote_t *wiimote, struct cwiid_state *state) { if (pthread_mutex_lock(&wiimote->state_mutex)) { cwiid_err(wiimote, "Mutex lock error (state mutex)"); return -1; } memcpy(state, &wiimote->state, sizeof *state); if (pthread_mutex_unlock(&wiimote->state_mutex)) { cwiid_err(wiimote, "Mutex unlock error (state mutex) - " "deadlock warning"); return -1; } return 0; } int cwiid_get_acc_cal(cwiid_wiimote_t *wiimote, enum cwiid_ext_type ext_type, struct acc_cal *acc_cal) { uint8_t flags; uint32_t offset; unsigned char buf[7]; char *err_str; switch (ext_type) { case CWIID_EXT_NONE: flags = CWIID_RW_EEPROM; offset = 0x16; err_str = ""; break; case CWIID_EXT_NUNCHUK: flags = CWIID_RW_REG; offset = 0xA40020; err_str = "nunchuk "; break; default: cwiid_err(wiimote, "Unsupported calibration request"); return -1; } if (cwiid_read(wiimote, flags, offset, 7, buf)) { cwiid_err(wiimote, "Read error (%scal)", err_str); return -1; } acc_cal->zero[CWIID_X] = buf[0]; acc_cal->zero[CWIID_Y] = buf[1]; acc_cal->zero[CWIID_Z] = buf[2]; acc_cal->one[CWIID_X] = buf[4]; acc_cal->one[CWIID_Y] = buf[5]; acc_cal->one[CWIID_Z] = buf[6]; return 0; } int cwiid_get_balance_cal(cwiid_wiimote_t *wiimote, struct balance_cal *balance_cal) { unsigned char buf[24]; if (cwiid_read(wiimote, CWIID_RW_REG, 0xa40024, 24, buf)) { cwiid_err(wiimote, "Read error (balancecal)"); return -1; } balance_cal->right_top[0] = ((uint16_t)buf[0]<<8 | (uint16_t)buf[1]); balance_cal->right_bottom[0] = ((uint16_t)buf[2]<<8 | (uint16_t)buf[3]); balance_cal->left_top[0] = ((uint16_t)buf[4]<<8 | (uint16_t)buf[5]); balance_cal->left_bottom[0] = ((uint16_t)buf[6]<<8 | (uint16_t)buf[7]); balance_cal->right_top[1] = ((uint16_t)buf[8]<<8 | (uint16_t)buf[9]); balance_cal->right_bottom[1] = ((uint16_t)buf[10]<<8 | (uint16_t)buf[11]); balance_cal->left_top[1] = ((uint16_t)buf[12]<<8 | (uint16_t)buf[13]); balance_cal->left_bottom[1] = ((uint16_t)buf[14]<<8 | (uint16_t)buf[15]); balance_cal->right_top[2] = ((uint16_t)buf[16]<<8 | (uint16_t)buf[17]); balance_cal->right_bottom[2] = ((uint16_t)buf[18]<<8 | (uint16_t)buf[19]); balance_cal->left_top[2] = ((uint16_t)buf[20]<<8 | (uint16_t)buf[21]); balance_cal->left_bottom[2] = ((uint16_t)buf[22]<<8 | (uint16_t)buf[23]); return 0; } cwiid-0.6.00+svn201/libcwiid/cwiid.h0000644000175000017500000002456011223453733016073 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2007-08-14 L. Donnie Smith * * make cwiid_err_default public * * 2007-05-16 L. Donnie Smith * * changed cwiid_connect, cwiid_disconnect to cwiid_open, cwiid_close * * added cwiid_request_status, cwiid_set_let, cwiid_set_rumble, * cwiid_set_rpt_mode * * 2007-05-14 L. Donnie Smith * * added timestamp to message functions * * added cwiid_get_acc_cal * * 2007-04-24 L. Donnie Smith * * rewrite for API overhaul * * 2007-04-09 L. Donnie Smith * * renamed wiimote to libcwiid, renamed structures accordingly * * 2007-04-07 L. Donnie Smith * * changed cwiid_info.class to btclass * * 2007-04-04 L. Donnie Smith * * added cwiid_mesg_error message type * * 2007-04-01 L. Donnie Smith * * cwiid_connect now takes a pointer to bdaddr_t * * added cwiid_info definition and macros * * added cwiid_get_info_array prototype * * changed cwiid_findfirst to cwiid_find_wiimote * * 2007-03-05 L. Donnie Smith * * added cwiid_err_t definition * * added cwiid_set_err prototype * * 2007-03-01 L. Donnie Smith * * Initial ChangeLog * * type audit (stdint, const, char booleans) */ #ifndef CWIID_H #define CWIID_H #include #include #include #include /* bdaddr_t */ /* Flags */ #define CWIID_FLAG_MESG_IFC 0x01 #define CWIID_FLAG_CONTINUOUS 0x02 #define CWIID_FLAG_REPEAT_BTN 0x04 #define CWIID_FLAG_NONBLOCK 0x08 #define CWIID_FLAG_MOTIONPLUS 0x10 /* Report Mode Flags */ #define CWIID_RPT_STATUS 0x01 #define CWIID_RPT_BTN 0x02 #define CWIID_RPT_ACC 0x04 #define CWIID_RPT_IR 0x08 #define CWIID_RPT_NUNCHUK 0x10 #define CWIID_RPT_CLASSIC 0x20 #define CWIID_RPT_BALANCE 0x40 #define CWIID_RPT_MOTIONPLUS 0x80 #define CWIID_RPT_EXT (CWIID_RPT_NUNCHUK | CWIID_RPT_CLASSIC | \ CWIID_RPT_BALANCE | CWIID_RPT_MOTIONPLUS) /* LED flags */ #define CWIID_LED1_ON 0x01 #define CWIID_LED2_ON 0x02 #define CWIID_LED3_ON 0x04 #define CWIID_LED4_ON 0x08 /* Button flags */ #define CWIID_BTN_2 0x0001 #define CWIID_BTN_1 0x0002 #define CWIID_BTN_B 0x0004 #define CWIID_BTN_A 0x0008 #define CWIID_BTN_MINUS 0x0010 #define CWIID_BTN_HOME 0x0080 #define CWIID_BTN_LEFT 0x0100 #define CWIID_BTN_RIGHT 0x0200 #define CWIID_BTN_DOWN 0x0400 #define CWIID_BTN_UP 0x0800 #define CWIID_BTN_PLUS 0x1000 #define CWIID_NUNCHUK_BTN_Z 0x01 #define CWIID_NUNCHUK_BTN_C 0x02 #define CWIID_CLASSIC_BTN_UP 0x0001 #define CWIID_CLASSIC_BTN_LEFT 0x0002 #define CWIID_CLASSIC_BTN_ZR 0x0004 #define CWIID_CLASSIC_BTN_X 0x0008 #define CWIID_CLASSIC_BTN_A 0x0010 #define CWIID_CLASSIC_BTN_Y 0x0020 #define CWIID_CLASSIC_BTN_B 0x0040 #define CWIID_CLASSIC_BTN_ZL 0x0080 #define CWIID_CLASSIC_BTN_R 0x0200 #define CWIID_CLASSIC_BTN_PLUS 0x0400 #define CWIID_CLASSIC_BTN_HOME 0x0800 #define CWIID_CLASSIC_BTN_MINUS 0x1000 #define CWIID_CLASSIC_BTN_L 0x2000 #define CWIID_CLASSIC_BTN_DOWN 0x4000 #define CWIID_CLASSIC_BTN_RIGHT 0x8000 /* Send Report flags */ #define CWIID_SEND_RPT_NO_RUMBLE 0x01 /* Data Read/Write flags */ #define CWIID_RW_EEPROM 0x00 #define CWIID_RW_REG 0x04 #define CWIID_RW_DECODE 0x00 /* Maximum Data Read Length */ #define CWIID_MAX_READ_LEN 0xFFFF /* Array Index Defs */ #define CWIID_X 0 #define CWIID_Y 1 #define CWIID_Z 2 #define CWIID_PHI 0 #define CWIID_THETA 1 #define CWIID_PSI 2 /* Acc Defs */ #define CWIID_ACC_MAX 0xFF /* IR Defs */ #define CWIID_IR_SRC_COUNT 4 #define CWIID_IR_X_MAX 1024 #define CWIID_IR_Y_MAX 768 /* Battery */ #define CWIID_BATTERY_MAX 0xD0 /* Classic Controller Maxes */ #define CWIID_CLASSIC_L_STICK_MAX 0x3F #define CWIID_CLASSIC_R_STICK_MAX 0x1F #define CWIID_CLASSIC_LR_MAX 0x1F /* Environment Variables */ #define WIIMOTE_BDADDR "WIIMOTE_BDADDR" /* Callback Maximum Message Count */ #define CWIID_MAX_MESG_COUNT 5 /* Enumerations */ enum cwiid_command { CWIID_CMD_STATUS, CWIID_CMD_LED, CWIID_CMD_RUMBLE, CWIID_CMD_RPT_MODE }; enum cwiid_mesg_type { CWIID_MESG_STATUS, CWIID_MESG_BTN, CWIID_MESG_ACC, CWIID_MESG_IR, CWIID_MESG_NUNCHUK, CWIID_MESG_CLASSIC, CWIID_MESG_BALANCE, CWIID_MESG_MOTIONPLUS, CWIID_MESG_ERROR, CWIID_MESG_UNKNOWN }; enum cwiid_ext_type { CWIID_EXT_NONE, CWIID_EXT_NUNCHUK, CWIID_EXT_CLASSIC, CWIID_EXT_BALANCE, CWIID_EXT_MOTIONPLUS, CWIID_EXT_UNKNOWN }; enum cwiid_error { CWIID_ERROR_NONE, CWIID_ERROR_DISCONNECT, CWIID_ERROR_COMM }; struct acc_cal { uint8_t zero[3]; uint8_t one[3]; }; struct balance_cal { uint16_t right_top[3]; uint16_t right_bottom[3]; uint16_t left_top[3]; uint16_t left_bottom[3]; }; /* Message Structs */ struct cwiid_status_mesg { enum cwiid_mesg_type type; uint8_t battery; enum cwiid_ext_type ext_type; }; struct cwiid_btn_mesg { enum cwiid_mesg_type type; uint16_t buttons; }; struct cwiid_acc_mesg { enum cwiid_mesg_type type; uint8_t acc[3]; }; struct cwiid_ir_src { char valid; uint16_t pos[2]; int8_t size; }; struct cwiid_ir_mesg { enum cwiid_mesg_type type; struct cwiid_ir_src src[CWIID_IR_SRC_COUNT]; }; struct cwiid_nunchuk_mesg { enum cwiid_mesg_type type; uint8_t stick[2]; uint8_t acc[3]; uint8_t buttons; }; struct cwiid_classic_mesg { enum cwiid_mesg_type type; uint8_t l_stick[2]; uint8_t r_stick[2]; uint8_t l; uint8_t r; uint16_t buttons; }; struct cwiid_balance_mesg { enum cwiid_mesg_type type; uint16_t right_top; uint16_t right_bottom; uint16_t left_top; uint16_t left_bottom; }; struct cwiid_motionplus_mesg { enum cwiid_mesg_type type; uint16_t angle_rate[3]; }; struct cwiid_error_mesg { enum cwiid_mesg_type type; enum cwiid_error error; }; union cwiid_mesg { enum cwiid_mesg_type type; struct cwiid_status_mesg status_mesg; struct cwiid_btn_mesg btn_mesg; struct cwiid_acc_mesg acc_mesg; struct cwiid_ir_mesg ir_mesg; struct cwiid_nunchuk_mesg nunchuk_mesg; struct cwiid_classic_mesg classic_mesg; struct cwiid_balance_mesg balance_mesg; struct cwiid_motionplus_mesg motionplus_mesg; struct cwiid_error_mesg error_mesg; }; /* State Structs */ struct nunchuk_state { uint8_t stick[2]; uint8_t acc[3]; uint8_t buttons; }; struct classic_state { uint8_t l_stick[2]; uint8_t r_stick[2]; uint8_t l; uint8_t r; uint16_t buttons; }; struct balance_state { uint16_t right_top; uint16_t right_bottom; uint16_t left_top; uint16_t left_bottom; }; struct motionplus_state { uint16_t angle_rate[3]; }; union ext_state { struct nunchuk_state nunchuk; struct classic_state classic; struct balance_state balance; struct motionplus_state motionplus; }; struct cwiid_state { uint8_t rpt_mode; uint8_t led; uint8_t rumble; uint8_t battery; uint16_t buttons; uint8_t acc[3]; struct cwiid_ir_src ir_src[CWIID_IR_SRC_COUNT]; enum cwiid_ext_type ext_type; union ext_state ext; enum cwiid_error error; }; /* Typedefs */ typedef struct wiimote cwiid_wiimote_t; typedef void cwiid_mesg_callback_t(cwiid_wiimote_t *, int, union cwiid_mesg [], struct timespec *); typedef void cwiid_err_t(cwiid_wiimote_t *, const char *, va_list ap); /* get_bdinfo */ #define BT_NO_WIIMOTE_FILTER 0x01 #define BT_NAME_LEN 32 struct cwiid_bdinfo { bdaddr_t bdaddr; uint8_t btclass[3]; char name[BT_NAME_LEN]; }; #ifdef __cplusplus extern "C" { #endif /* Error reporting (library wide) */ int cwiid_set_err(cwiid_err_t *err); void cwiid_err_default(struct wiimote *wiimote, const char *str, va_list ap); /* Connection */ #define cwiid_connect cwiid_open #define cwiid_disconnect cwiid_close cwiid_wiimote_t *cwiid_open(bdaddr_t *bdaddr, int flags); cwiid_wiimote_t *cwiid_open_timeout(bdaddr_t *bdaddr, int flags, int timeout); int cwiid_close(cwiid_wiimote_t *wiimote); int cwiid_get_id(cwiid_wiimote_t *wiimote); int cwiid_set_data(cwiid_wiimote_t *wiimote, const void *data); const void *cwiid_get_data(cwiid_wiimote_t *wiimote); int cwiid_enable(cwiid_wiimote_t *wiimote, int flags); int cwiid_disable(cwiid_wiimote_t *wiimote, int flags); /* Interfaces */ int cwiid_set_mesg_callback(cwiid_wiimote_t *wiimote, cwiid_mesg_callback_t *callback); int cwiid_get_mesg(cwiid_wiimote_t *wiimote, int *mesg_count, union cwiid_mesg *mesg[], struct timespec *timestamp); int cwiid_get_state(cwiid_wiimote_t *wiimote, struct cwiid_state *state); int cwiid_get_acc_cal(struct wiimote *wiimote, enum cwiid_ext_type ext_type, struct acc_cal *acc_cal); int cwiid_get_balance_cal(struct wiimote *wiimote, struct balance_cal *balance_cal); /* Operations */ int cwiid_command(cwiid_wiimote_t *wiimote, enum cwiid_command command, int flags); int cwiid_send_rpt(cwiid_wiimote_t *wiimote, uint8_t flags, uint8_t report, size_t len, const void *data); int cwiid_request_status(cwiid_wiimote_t *wiimote); int cwiid_set_led(cwiid_wiimote_t *wiimote, uint8_t led); int cwiid_set_rumble(cwiid_wiimote_t *wiimote, uint8_t rumble); int cwiid_set_rpt_mode(cwiid_wiimote_t *wiimote, uint8_t rpt_mode); int cwiid_read(cwiid_wiimote_t *wiimote, uint8_t flags, uint32_t offset, uint16_t len, void *data); int cwiid_write(cwiid_wiimote_t *wiimote, uint8_t flags, uint32_t offset, uint16_t len, const void *data); /* int cwiid_beep(cwiid_wiimote_t *wiimote); */ /* HCI functions */ int cwiid_get_bdinfo_array(int dev_id, unsigned int timeout, int max_bdinfo, struct cwiid_bdinfo **bdinfo, uint8_t flags); int cwiid_find_wiimote(bdaddr_t *bdaddr, int timeout); #ifdef __cplusplus } #endif #endif cwiid-0.6.00+svn201/libcwiid/command.c0000644000175000017500000002351611215570367016411 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2007-05-16 L. Donnie Smith * * added cwiid_request_status, cwiid_set_let, cwiid_set_rumble, * cwiid_set_rpt_mode * * 2007-04-24 L. Donnie Smith * * rewrite for API overhaul * * added rw and beep functions from rw.c * * 2007-04-09 L. Donnie Smith * * renamed wiimote to libcwiid, renamed structures accordingly * * 2007-04-04 L. Donnie Smith * * updated cwiid_read and cwiid_write to trigger and detect rw_error * * 2007-03-14 L. Donnie Smith * * audited error checking (coda and error handler sections) * * updated comments * * cwiid_read - changed to obey decode flag only for register read * * 2007-03-06 L. Donnie Smith * * added wiimote parameter to cwiid_err calls * * 2007-03-01 L. Donnie Smith * * Initial ChangeLog * * type audit (stdint, const, char booleans) */ #include #include #include #include #include #include "cwiid_internal.h" int cwiid_command(cwiid_wiimote_t *wiimote, enum cwiid_command command, int flags) { int ret; switch (command) { case CWIID_CMD_STATUS: ret = cwiid_request_status(wiimote); break; case CWIID_CMD_LED: ret = cwiid_set_led(wiimote, flags); break; case CWIID_CMD_RUMBLE: ret = cwiid_set_rumble(wiimote, flags); break; case CWIID_CMD_RPT_MODE: ret = cwiid_set_rpt_mode(wiimote, flags); break; default: ret = -1; break; } return ret; } /* TODO: fix error reporting - this is public now and * should report its own errors */ int cwiid_send_rpt(cwiid_wiimote_t *wiimote, uint8_t flags, uint8_t report, size_t len, const void *data) { unsigned char *buf; if ((buf = malloc((len*2) * sizeof *buf)) == NULL) { cwiid_err(wiimote, "Memory allocation error (mesg array)"); return -1; } buf[0] = BT_TRANS_SET_REPORT | BT_PARAM_OUTPUT; buf[1] = report; memcpy(buf+2, data, len); if (!(flags & CWIID_SEND_RPT_NO_RUMBLE)) { buf[2] |= wiimote->state.rumble; } if (write(wiimote->ctl_socket, buf, len+2) != (ssize_t)(len+2)) { free(buf); return -1; } else if (verify_handshake(wiimote)) { free(buf); return -1; } return 0; } int cwiid_request_status(cwiid_wiimote_t *wiimote) { unsigned char data; data = 0; if (cwiid_send_rpt(wiimote, 0, RPT_STATUS_REQ, 1, &data)) { cwiid_err(wiimote, "Status request error"); return -1; } return 0; } int cwiid_set_led(cwiid_wiimote_t *wiimote, uint8_t led) { unsigned char data; /* TODO: assumption: char assignments are atomic, no mutex lock needed */ wiimote->state.led = led & 0x0F; data = wiimote->state.led << 4; if (cwiid_send_rpt(wiimote, 0, RPT_LED_RUMBLE, 1, &data)) { cwiid_err(wiimote, "Report send error (led)"); return -1; } return 0; } int cwiid_set_rumble(cwiid_wiimote_t *wiimote, uint8_t rumble) { unsigned char data; /* TODO: assumption: char assignments are atomic, no mutex lock needed */ wiimote->state.rumble = rumble ? 1 : 0; data = wiimote->state.led << 4; if (cwiid_send_rpt(wiimote, 0, RPT_LED_RUMBLE, 1, &data)) { cwiid_err(wiimote, "Report send error (led)"); return -1; } return 0; } int cwiid_set_rpt_mode(cwiid_wiimote_t *wiimote, uint8_t rpt_mode) { return update_rpt_mode(wiimote, rpt_mode); } #define RPT_READ_REQ_LEN 6 int cwiid_read(cwiid_wiimote_t *wiimote, uint8_t flags, uint32_t offset, uint16_t len, void *data) { unsigned char buf[RPT_READ_REQ_LEN]; struct rw_mesg mesg; unsigned char *cursor; int ret = 0; /* Compose read request packet */ buf[0]=flags & (CWIID_RW_EEPROM | CWIID_RW_REG); buf[1]=(unsigned char)((offset>>16) & 0xFF); buf[2]=(unsigned char)((offset>>8) & 0xFF); buf[3]=(unsigned char)(offset & 0xFF); buf[4]=(unsigned char)((len>>8) & 0xFF); buf[5]=(unsigned char)(len & 0xFF); /* Lock wiimote rw access */ if (pthread_mutex_lock(&wiimote->rw_mutex)) { cwiid_err(wiimote, "Mutex lock error (rw_mutex)"); return -1; } /* Setup read info */ wiimote->rw_status = RW_READ; /* TODO: Document: user is responsible for ensuring that read/write * operations are not in flight while disconnecting. Nothing serious, * just accesses to freed memory */ /* Send read request packet */ if (cwiid_send_rpt(wiimote, 0, RPT_READ_REQ, RPT_READ_REQ_LEN, buf)) { cwiid_err(wiimote, "Report send error (read)"); ret = -1; goto CODA; } /* TODO:Better sanity checks (offset) */ /* Read packets */ for (cursor = data; cursor - (unsigned char *)data < len; cursor += mesg.len) { if (full_read(wiimote->rw_pipe[0], &mesg, sizeof mesg)) { cwiid_err(wiimote, "Pipe read error (rw pipe)"); ret = -1; goto CODA; } if (mesg.type == RW_CANCEL) { ret = -1; goto CODA; } else if (mesg.type != RW_READ) { cwiid_err(wiimote, "Unexpected write message"); ret = -1; goto CODA; } if (mesg.error) { cwiid_err(wiimote, "Wiimote read error"); ret = -1; goto CODA; } memcpy(cursor, &mesg.data, mesg.len); } CODA: /* Clear rw_status */ wiimote->rw_status = RW_IDLE; /* Unlock rw_mutex */ if (pthread_mutex_unlock(&wiimote->rw_mutex)) { cwiid_err(wiimote, "Mutex unlock error (rw_mutex) - deadlock warning"); } return ret; } #define RPT_WRITE_LEN 21 int cwiid_write(cwiid_wiimote_t *wiimote, uint8_t flags, uint32_t offset, uint16_t len, const void *data) { unsigned char buf[RPT_WRITE_LEN]; uint16_t sent=0; struct rw_mesg mesg; int ret = 0; /* Compose write packet header */ buf[0]=flags; /* Lock wiimote rw access */ if (pthread_mutex_lock(&wiimote->rw_mutex)) { cwiid_err(wiimote, "Mutex lock error (rw mutex)"); return -1; } /* Send packets */ wiimote->rw_status = RW_WRITE; while (sent>16) & 0xFF); buf[2]=(unsigned char)(((offset+sent)>>8) & 0xFF); buf[3]=(unsigned char)((offset+sent) & 0xFF); if (len-sent >= 0x10) { buf[4]=(unsigned char)0x10; } else { buf[4]=(unsigned char)(len-sent); } memcpy(buf+5, data+sent, buf[4]); if (cwiid_send_rpt(wiimote, 0, RPT_WRITE, RPT_WRITE_LEN, buf)) { cwiid_err(wiimote, "Report send error (write)"); ret = -1; goto CODA; } /* Read packets from pipe */ if (read(wiimote->rw_pipe[0], &mesg, sizeof mesg) != sizeof mesg) { cwiid_err(wiimote, "Pipe read error (rw pipe)"); ret = -1; goto CODA; } if (mesg.type == RW_CANCEL) { ret = -1; goto CODA; } else if (mesg.type != RW_WRITE) { cwiid_err(wiimote, "Unexpected read message"); ret = -1; goto CODA; } if (mesg.error) { cwiid_err(wiimote, "Wiimote write error"); ret = -1; goto CODA; }; sent+=buf[4]; } CODA: /* Clear rw_status */ wiimote->rw_status = RW_IDLE; /* Unlock rw_mutex */ if (pthread_mutex_unlock(&wiimote->rw_mutex)) { cwiid_err(wiimote, "Mutex unlock error (rw_mutex) - deadlock warning"); } return ret; } struct write_seq speaker_enable_seq[] = { {WRITE_SEQ_RPT, RPT_SPEAKER_ENABLE, (const void *)"\x04", 1, 0}, {WRITE_SEQ_RPT, RPT_SPEAKER_MUTE, (const void *)"\x04", 1, 0}, {WRITE_SEQ_MEM, 0xA20009, (const void *)"\x01", 1, CWIID_RW_REG}, {WRITE_SEQ_MEM, 0xA20001, (const void *)"\x08", 1, CWIID_RW_REG}, {WRITE_SEQ_MEM, 0xA20001, (const void *)"\x00\x00\x00\x0C\x40\x00\x00", 7, CWIID_RW_REG}, {WRITE_SEQ_MEM, 0xA20008, (const void *)"\x01", 1, CWIID_RW_REG}, {WRITE_SEQ_RPT, RPT_SPEAKER_MUTE, (const void *)"\x00", 1, 0} }; struct write_seq speaker_disable_seq[] = { {WRITE_SEQ_RPT, RPT_SPEAKER_MUTE, (const void *)"\x04", 1, 0}, {WRITE_SEQ_RPT, RPT_SPEAKER_ENABLE, (const void *)"\x00", 1, 0} }; #define SOUND_BUF_LEN 21 int cwiid_beep(cwiid_wiimote_t *wiimote) { /* unsigned char buf[SOUND_BUF_LEN] = { 0xA0, 0xCC, 0x33, 0xCC, 0x33, 0xCC, 0x33, 0xCC, 0x33, 0xCC, 0x33, 0xCC, 0x33, 0xCC, 0x33, 0xCC, 0x33, 0xCC, 0x33, 0xCC, 0x33}; */ unsigned char buf[SOUND_BUF_LEN] = { 0xA0, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3, 0xC3}; int i; int ret = 0; pthread_mutex_t timer_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t timer_cond = PTHREAD_COND_INITIALIZER; struct timespec t; if (exec_write_seq(wiimote, SEQ_LEN(speaker_enable_seq), speaker_enable_seq)) { cwiid_err(wiimote, "Speaker enable error"); ret = -1; } pthread_mutex_lock(&timer_mutex); for (i=0; i<100; i++) { clock_gettime(CLOCK_REALTIME, &t); t.tv_nsec += 10204081; /* t.tv_nsec += 7000000; */ if (cwiid_send_rpt(wiimote, 0, RPT_SPEAKER_DATA, SOUND_BUF_LEN, buf)) { printf("%d\n", i); cwiid_err(wiimote, "Report send error (speaker data)"); ret = -1; break; } /* TODO: I should be shot for this, but hey, it works. * longterm - find a better wait */ pthread_cond_timedwait(&timer_cond, &timer_mutex, &t); } pthread_mutex_unlock(&timer_mutex); if (exec_write_seq(wiimote, SEQ_LEN(speaker_disable_seq), speaker_disable_seq)) { cwiid_err(wiimote, "Speaker disable error"); ret = -1; } return ret; } cwiid-0.6.00+svn201/libcwiid/cwiid.pc.in0000644000175000017500000000050310742047311016636 0ustar tootstootsprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ sysconfdir=@sysconfdir@ cwiid_config_dir=@CWIID_CONFIG_DIR@ cwiid_plugins_dir=@CWIID_PLUGINS_DIR@ Name: CWiid Description: CWiid Wiimote Interface Version: @PACKAGE_VERSION@ Requires: bluez Libs: -L${libdir} -lcwiid Cflags: -I${includedir} cwiid-0.6.00+svn201/libcwiid/connect.c0000644000175000017500000002517311215570367016425 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2009-06-13 L. Donnie Smith * * add cwiid_open_timeout function, call it with default from cwiid_open * * 2007-06-14 L. Donnie Smith * * added sleep after cwiid_find_wiimote call * * 2007-05-16 L. Donnie Smith * * remove error_pipe init and destruct * * renamed connect and disconnect to open and close * * 2007-04-24 L. Donnie Smith * * rewrite for API overhaul * * 2007-04-09 L. Donnie Smith * * renamed wiimote to libcwiid, renamed structures accordingly * * 2007-04-04 L. Donnie Smith * * cancel rw operations from cwiid_disconnect * * 2007-04-01 L. Donnie Smith * * cwiid_connect now takes a pointer to bdaddr_t * * changed cwiid_findfirst to cwiid_find_wiimote * * 2007-03-14 L. Donnie Smith * * changed memcpy to bacmp * * audited error checking (coda and error handler sections) * * updated comments * * 2007-03-06 L. Donnie Smith * * added wiimote parameter to cwiid_err calls * * 2007-03-01 L. Donnie Smith * * Initial ChangeLog */ #include #include #include #include #include #include #include #include #include #include "cwiid_internal.h" pthread_mutex_t global_mutex = PTHREAD_MUTEX_INITIALIZER; static int wiimote_id = 0; /* TODO: Turn this onto a macro on next major so version */ cwiid_wiimote_t *cwiid_open(bdaddr_t *bdaddr, int flags) { return cwiid_open_timeout(bdaddr, flags, 5); } cwiid_wiimote_t *cwiid_open_timeout(bdaddr_t *bdaddr, int flags, int timeout) { struct wiimote *wiimote = NULL; struct sockaddr_l2 remote_addr; char mesg_pipe_init = 0, status_pipe_init = 0, rw_pipe_init = 0, state_mutex_init = 0, rw_mutex_init = 0, rpt_mutex_init = 0, router_thread_init = 0, status_thread_init = 0; void *pthread_ret; /* Allocate wiimote */ if ((wiimote = malloc(sizeof *wiimote)) == NULL) { cwiid_err(NULL, "Memory allocation error (cwiid_wiimote_t)"); goto ERR_HND; } /* set flags */ wiimote->flags = flags; /* For error detection */ wiimote->ctl_socket = wiimote->int_socket = -1; /* Global Lock, Store and Increment wiimote_id */ if (pthread_mutex_lock(&global_mutex)) { cwiid_err(NULL, "Mutex lock error (global mutex)"); goto ERR_HND; } wiimote->id = wiimote_id++; if (pthread_mutex_unlock(&global_mutex)) { cwiid_err(wiimote, "Mutex unlock error (global mutex) - " "deadlock warning"); goto ERR_HND; } /* If BDADDR_ANY is given, find available wiimote */ if (bacmp(bdaddr, BDADDR_ANY) == 0) { if (cwiid_find_wiimote(bdaddr, timeout)) { goto ERR_HND; } sleep(1); } /* Connect to Wiimote */ /* Control Channel */ memset(&remote_addr, 0, sizeof remote_addr); remote_addr.l2_family = AF_BLUETOOTH; remote_addr.l2_bdaddr = *bdaddr; remote_addr.l2_psm = htobs(CTL_PSM); if ((wiimote->ctl_socket = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1) { cwiid_err(wiimote, "Socket creation error (control socket)"); goto ERR_HND; } if (connect(wiimote->ctl_socket, (struct sockaddr *)&remote_addr, sizeof remote_addr)) { cwiid_err(wiimote, "Socket connect error (control channel)"); goto ERR_HND; } /* Interrupt Channel */ remote_addr.l2_psm = htobs(INT_PSM); if ((wiimote->int_socket = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1) { cwiid_err(wiimote, "Socket creation error (interrupt socket)"); goto ERR_HND; } if (connect(wiimote->int_socket, (struct sockaddr *)&remote_addr, sizeof remote_addr)) { cwiid_err(wiimote, "Socket connect error (interrupt channel)"); goto ERR_HND; } /* Create pipes */ if (pipe(wiimote->mesg_pipe)) { cwiid_err(wiimote, "Pipe creation error (mesg pipe)"); goto ERR_HND; } mesg_pipe_init = 1; if (pipe(wiimote->status_pipe)) { cwiid_err(wiimote, "Pipe creation error (status pipe)"); goto ERR_HND; } status_pipe_init = 1; if (pipe(wiimote->rw_pipe)) { cwiid_err(wiimote, "Pipe creation error (rw pipe)"); goto ERR_HND; } rw_pipe_init = 1; /* Setup blocking */ if (fcntl(wiimote->mesg_pipe[1], F_SETFL, O_NONBLOCK)) { cwiid_err(wiimote, "File control error (mesg write pipe)"); goto ERR_HND; } if (wiimote->flags & CWIID_FLAG_NONBLOCK) { if (fcntl(wiimote->mesg_pipe[0], F_SETFL, O_NONBLOCK)) { cwiid_err(wiimote, "File control error (mesg read pipe)"); goto ERR_HND; } } /* Init mutexes */ if (pthread_mutex_init(&wiimote->state_mutex, NULL)) { cwiid_err(wiimote, "Mutex initialization error (state mutex)"); goto ERR_HND; } state_mutex_init = 1; if (pthread_mutex_init(&wiimote->rw_mutex, NULL)) { cwiid_err(wiimote, "Mutex initialization error (rw mutex)"); goto ERR_HND; } rw_mutex_init = 1; if (pthread_mutex_init(&wiimote->rpt_mutex, NULL)) { cwiid_err(wiimote, "Mutex initialization error (rpt mutex)"); goto ERR_HND; } rpt_mutex_init = 1; /* Set rw_status before starting router thread */ wiimote->rw_status = RW_IDLE; /* Launch interrupt channel listener and dispatch threads */ if (pthread_create(&wiimote->router_thread, NULL, (void *(*)(void *))&router_thread, wiimote)) { cwiid_err(wiimote, "Thread creation error (router thread)"); goto ERR_HND; } router_thread_init = 1; if (pthread_create(&wiimote->status_thread, NULL, (void *(*)(void *))&status_thread, wiimote)) { cwiid_err(wiimote, "Thread creation error (status thread)"); goto ERR_HND; } status_thread_init = 1; /* Success! Update state */ memset(&wiimote->state, 0, sizeof wiimote->state); wiimote->mesg_callback = NULL; cwiid_set_led(wiimote, 0); cwiid_request_status(wiimote); return wiimote; ERR_HND: if (wiimote) { /* Close threads */ if (router_thread_init) { pthread_cancel(wiimote->router_thread); if (pthread_join(wiimote->router_thread, &pthread_ret)) { cwiid_err(wiimote, "Thread join error (router thread)"); } else if (!((pthread_ret == PTHREAD_CANCELED) && (pthread_ret == NULL))) { cwiid_err(wiimote, "Bad return value from router thread"); } } if (status_thread_init) { pthread_cancel(wiimote->status_thread); if (pthread_join(wiimote->status_thread, &pthread_ret)) { cwiid_err(wiimote, "Thread join error (status thread)"); } else if (!((pthread_ret == PTHREAD_CANCELED) && (pthread_ret == NULL))) { cwiid_err(wiimote, "Bad return value from status thread"); } } /* Close Sockets */ if (wiimote->int_socket != -1) { if (close(wiimote->int_socket)) { cwiid_err(wiimote, "Socket close error (interrupt channel)"); } } if (wiimote->ctl_socket != -1) { if (close(wiimote->ctl_socket)) { cwiid_err(wiimote, "Socket close error (control channel)"); } } /* Close Pipes */ if (mesg_pipe_init) { if (close(wiimote->mesg_pipe[0]) || close(wiimote->mesg_pipe[1])) { cwiid_err(wiimote, "Pipe close error (mesg pipe)"); } } if (status_pipe_init) { if (close(wiimote->status_pipe[0]) || close(wiimote->status_pipe[1])) { cwiid_err(wiimote, "Pipe close error (status pipe)"); } } if (rw_pipe_init) { if (close(wiimote->rw_pipe[0]) || close(wiimote->rw_pipe[1])) { cwiid_err(wiimote, "Pipe close error (rw pipe)"); } } /* Destroy Mutexes */ if (state_mutex_init) { if (pthread_mutex_destroy(&wiimote->state_mutex)) { cwiid_err(wiimote, "Mutex destroy error (state mutex)"); } } if (rw_mutex_init) { if (pthread_mutex_destroy(&wiimote->rw_mutex)) { cwiid_err(wiimote, "Mutex destroy error (rw mutex)"); } } if (rpt_mutex_init) { if (pthread_mutex_destroy(&wiimote->rpt_mutex)) { cwiid_err(wiimote, "Mutex destroy error (rpt mutex)"); } } free(wiimote); } return NULL; } int cwiid_close(cwiid_wiimote_t *wiimote) { void *pthread_ret; /* Cancel and join router_thread and status_thread */ if (pthread_cancel(wiimote->router_thread)) { /* if thread quit abnormally, would have printed it's own error */ } if (pthread_join(wiimote->router_thread, &pthread_ret)) { cwiid_err(wiimote, "Thread join error (router thread)"); } else if (!((pthread_ret == PTHREAD_CANCELED) || (pthread_ret == NULL))) { cwiid_err(wiimote, "Bad return value from router thread"); } if (pthread_cancel(wiimote->status_thread)) { /* if thread quit abnormally, would have printed it's own error */ } if (pthread_join(wiimote->status_thread, &pthread_ret)) { cwiid_err(wiimote, "Thread join error (status thread)"); } else if (!((pthread_ret == PTHREAD_CANCELED) || (pthread_ret == NULL))) { cwiid_err(wiimote, "Bad return value from status thread"); } if (wiimote->mesg_callback) { if (cancel_mesg_callback(wiimote)) { /* prints it's own errors */ } } if (cancel_rw(wiimote)) { /* prints it's own errors */ } /* Close sockets */ if (close(wiimote->int_socket)) { cwiid_err(wiimote, "Socket close error (interrupt channel)"); } if (close(wiimote->ctl_socket)) { cwiid_err(wiimote, "Socket close error (control channel)"); } /* Close Pipes */ if (close(wiimote->mesg_pipe[0]) || close(wiimote->mesg_pipe[1])) { cwiid_err(wiimote, "Pipe close error (mesg pipe)"); } if (close(wiimote->status_pipe[0]) || close(wiimote->status_pipe[1])) { cwiid_err(wiimote, "Pipe close error (status pipe)"); } if (close(wiimote->rw_pipe[0]) || close(wiimote->rw_pipe[1])) { cwiid_err(wiimote, "Pipe close error (rw pipe)"); } /* Destroy mutexes */ if (pthread_mutex_destroy(&wiimote->state_mutex)) { cwiid_err(wiimote, "Mutex destroy error (state)"); } if (pthread_mutex_destroy(&wiimote->rw_mutex)) { cwiid_err(wiimote, "Mutex destroy error (rw)"); } if (pthread_mutex_destroy(&wiimote->rpt_mutex)) { cwiid_err(wiimote, "Mutex destroy error (rpt)"); } free(wiimote); return 0; } cwiid-0.6.00+svn201/libcwiid/bluetooth.c0000644000175000017500000001261211215117240016756 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2007-04-24 L. Donnie Smith (cwiid@abstrakraft.org> * * revised error messages * * 2007-04-12 L. Donnie Smith * * streamlined wiimote filter * * 2007-04-09 L. Donnie Smith * * renamed wiimote to libcwiid, renamed structures accordingly * * 2007-04-07 L. Donnie Smith * * changed cwiid_info.class to btclass * * 2007-04-03 L. Donnie Smith * * fixed cwiid_find_wiimote seg fault * * 2007-04-02 L. Donnie Smith * * exception handling bugs * * 2007-04-01 L. Donnie Smith * * created file */ #include #include #include #include #include #include "cwiid_internal.h" /* When filtering wiimotes, in order to avoid having to store the * remote names before the blue_dev array is malloced (because we don't * yet know how many wiimotes there are, we'll assume there are no more * than dev_count, and realloc to the actual number afterwards, since * reallocing to a smaller chunk should be fast. */ #define BT_MAX_INQUIRY 256 /* timeout in 2 second units */ int cwiid_get_bdinfo_array(int dev_id, unsigned int timeout, int max_bdinfo, struct cwiid_bdinfo **bdinfo, uint8_t flags) { inquiry_info *dev_list = NULL; int max_inquiry; int dev_count; int sock = -1; int bdinfo_count; int i, j; int err = 0; int ret; /* NULLify for the benefit of error handling */ *bdinfo = NULL; /* If not given (=-1), get the first available Bluetooth interface */ if (dev_id == -1) { if ((dev_id = hci_get_route(NULL)) == -1) { cwiid_err(NULL, "No Bluetooth interface found"); return -1; } } /* Get Bluetooth Device List */ if ((flags & BT_NO_WIIMOTE_FILTER) && (max_bdinfo != -1)) { max_inquiry = max_bdinfo; } else { max_inquiry = BT_MAX_INQUIRY; } if ((dev_count = hci_inquiry(dev_id, timeout, max_inquiry, NULL, &dev_list, IREQ_CACHE_FLUSH)) == -1) { cwiid_err(NULL, "Bluetooth device inquiry error"); err = 1; goto CODA; } if (dev_count == 0) { bdinfo_count = 0; goto CODA; } /* Open connection to Bluetooth Interface */ if ((sock = hci_open_dev(dev_id)) == -1) { cwiid_err(NULL, "Bluetooth interface open error"); err = 1; goto CODA; } /* Allocate info list */ if (max_bdinfo == -1) { max_bdinfo = dev_count; } if ((*bdinfo = malloc(max_bdinfo * sizeof **bdinfo)) == NULL) { cwiid_err(NULL, "Memory allocation error (bdinfo array)"); err = 1; goto CODA; } /* Copy dev_list to bdinfo */ for (bdinfo_count=i=0; (i < dev_count) && (bdinfo_count < max_bdinfo); i++) { /* Filter by class */ if (!(flags & BT_NO_WIIMOTE_FILTER) && ((dev_list[i].dev_class[0] != WIIMOTE_CLASS_0) || (dev_list[i].dev_class[1] != WIIMOTE_CLASS_1) || (dev_list[i].dev_class[2] != WIIMOTE_CLASS_2))) { continue; } /* timeout (10000) in milliseconds */ if (hci_read_remote_name(sock, &dev_list[i].bdaddr, BT_NAME_LEN, (*bdinfo)[bdinfo_count].name, 10000)) { cwiid_err(NULL, "Bluetooth name read error"); err = 1; goto CODA; } /* Filter by name */ if (!(flags & BT_NO_WIIMOTE_FILTER) && strncmp((*bdinfo)[bdinfo_count].name, WIIMOTE_NAME, BT_NAME_LEN) && strncmp((*bdinfo)[bdinfo_count].name, WIIBALANCE_NAME, BT_NAME_LEN)) { continue; } /* Passed filter, add to bdinfo */ bacpy(&(*bdinfo)[bdinfo_count].bdaddr, &dev_list[i].bdaddr); for (j=0; j<3; j++) { (*bdinfo)[bdinfo_count].btclass[j] = dev_list[i].dev_class[j]; } bdinfo_count++; } if (bdinfo_count == 0) { free(*bdinfo); } else if (bdinfo_count < max_bdinfo) { if ((*bdinfo = realloc(*bdinfo, bdinfo_count * sizeof **bdinfo)) == NULL) { cwiid_err(NULL, "Memory reallocation error (bdinfo array)"); err = 1; goto CODA; } } CODA: if (dev_list) free(dev_list); if (sock != -1) hci_close_dev(sock); if (err) { if (*bdinfo) free(*bdinfo); ret = -1; } else { ret = bdinfo_count; } return ret; } int cwiid_find_wiimote(bdaddr_t *bdaddr, int timeout) { struct cwiid_bdinfo *bdinfo; int bdinfo_count; if (timeout == -1) { while ((bdinfo_count = cwiid_get_bdinfo_array(-1, 2, 1, &bdinfo, 0)) == 0); if (bdinfo_count == -1) { return -1; } } else { bdinfo_count = cwiid_get_bdinfo_array(-1, timeout, 1, &bdinfo, 0); if (bdinfo_count == -1) { return -1; } else if (bdinfo_count == 0) { cwiid_err(NULL, "No wiimotes found"); return -1; } } bacpy(bdaddr, &bdinfo[0].bdaddr); free(bdinfo); return 0; } cwiid-0.6.00+svn201/libcwiid/state.c0000644000175000017500000002102211223453733016075 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2007-04-24 L. Donnie Smith * * created for API overhaul (update_rpt_mode moved from command.c) */ #include #include #include "cwiid_internal.h" int update_state(struct wiimote *wiimote, struct mesg_array *ma) { int i; union cwiid_mesg *mesg; if (pthread_mutex_lock(&wiimote->state_mutex)) { cwiid_err(wiimote, "Mutex lock error (state mutex)"); return -1; } for (i=0; i < ma->count; i++) { mesg = &ma->array[i]; switch (mesg->type) { case CWIID_MESG_STATUS: wiimote->state.battery = mesg->status_mesg.battery; if (wiimote->state.ext_type != mesg->status_mesg.ext_type) { memset(&wiimote->state.ext, 0, sizeof wiimote->state.ext); wiimote->state.ext_type = mesg->status_mesg.ext_type; } break; case CWIID_MESG_BTN: wiimote->state.buttons = mesg->btn_mesg.buttons; break; case CWIID_MESG_ACC: memcpy(wiimote->state.acc, mesg->acc_mesg.acc, sizeof wiimote->state.acc); break; case CWIID_MESG_IR: memcpy(wiimote->state.ir_src, mesg->ir_mesg.src, sizeof wiimote->state.ir_src); break; case CWIID_MESG_NUNCHUK: memcpy(wiimote->state.ext.nunchuk.stick, mesg->nunchuk_mesg.stick, sizeof wiimote->state.ext.nunchuk.stick); memcpy(wiimote->state.ext.nunchuk.acc, mesg->nunchuk_mesg.acc, sizeof wiimote->state.ext.nunchuk.acc); wiimote->state.ext.nunchuk.buttons = mesg->nunchuk_mesg.buttons; break; case CWIID_MESG_CLASSIC: memcpy(wiimote->state.ext.classic.l_stick, mesg->classic_mesg.l_stick, sizeof wiimote->state.ext.classic.l_stick); memcpy(wiimote->state.ext.classic.r_stick, mesg->classic_mesg.r_stick, sizeof wiimote->state.ext.classic.r_stick); wiimote->state.ext.classic.l = mesg->classic_mesg.l; wiimote->state.ext.classic.r = mesg->classic_mesg.r; wiimote->state.ext.classic.buttons = mesg->classic_mesg.buttons; break; case CWIID_MESG_BALANCE: wiimote->state.ext.balance.right_top = mesg->balance_mesg.right_top; wiimote->state.ext.balance.right_bottom = mesg->balance_mesg.right_bottom; wiimote->state.ext.balance.left_top = mesg->balance_mesg.left_top; wiimote->state.ext.balance.left_bottom = mesg->balance_mesg.left_bottom; break; case CWIID_MESG_MOTIONPLUS: memcpy(wiimote->state.ext.motionplus.angle_rate, mesg->motionplus_mesg.angle_rate, sizeof wiimote->state.ext.motionplus.angle_rate); break; case CWIID_MESG_ERROR: wiimote->state.error = mesg->error_mesg.error; break; case CWIID_MESG_UNKNOWN: /* do nothing, error has already been printed */ break; } } if (pthread_mutex_unlock(&wiimote->state_mutex)) { cwiid_err(wiimote, "Mutex unlock error (state mutex) - " "deadlock warning"); return -1; } return 0; } /* IR Sensitivity Block */ unsigned char ir_block1[] = CLIFF_IR_BLOCK_1; unsigned char ir_block2[] = CLIFF_IR_BLOCK_2; struct write_seq ir_enable10_seq[] = { {WRITE_SEQ_RPT, RPT_IR_ENABLE1, (const void *)"\x04", 1, 0}, {WRITE_SEQ_RPT, RPT_IR_ENABLE2, (const void *)"\x04", 1, 0}, {WRITE_SEQ_MEM, 0xB00030, (const void *)"\x08", 1, CWIID_RW_REG}, {WRITE_SEQ_MEM, 0xB00000, ir_block1, sizeof(ir_block1)-1, CWIID_RW_REG}, {WRITE_SEQ_MEM, 0xB0001A, ir_block2, sizeof(ir_block2)-1, CWIID_RW_REG}, {WRITE_SEQ_MEM, 0xB00033, (const void *)"\x01", 1, CWIID_RW_REG} }; struct write_seq ir_enable12_seq[] = { {WRITE_SEQ_RPT, RPT_IR_ENABLE1, (const void *)"\x04", 1, 0}, {WRITE_SEQ_RPT, RPT_IR_ENABLE2, (const void *)"\x04", 1, 0}, {WRITE_SEQ_MEM, 0xB00030, (const void *)"\x08", 1, CWIID_RW_REG}, {WRITE_SEQ_MEM, 0xB00000, ir_block1, sizeof(ir_block1)-1, CWIID_RW_REG}, {WRITE_SEQ_MEM, 0xB0001A, ir_block2, sizeof(ir_block2)-1, CWIID_RW_REG}, {WRITE_SEQ_MEM, 0xB00033, (const void *)"\x03", 1, CWIID_RW_REG} }; struct write_seq ir_disable_seq[] = { {WRITE_SEQ_RPT, RPT_IR_ENABLE1, (const void *)"\x00", 1, 0}, {WRITE_SEQ_RPT, RPT_IR_ENABLE2, (const void *)"\x00", 1, 0} }; #define RPT_MODE_BUF_LEN 2 int update_rpt_mode(struct wiimote *wiimote, int8_t rpt_mode) { unsigned char buf[RPT_MODE_BUF_LEN]; uint8_t rpt_type; struct write_seq *ir_enable_seq; int seq_len; /* rpt_mode = bitmask of requested report types */ /* rpt_type = report id sent to the wiimote */ if (pthread_mutex_lock(&wiimote->rpt_mutex)) { cwiid_err(wiimote, "Mutex lock error (rpt mutex)"); return -1; } /* -1 updates the reporting mode using old rpt_mode * (reporting type may change if extensions are * plugged in/unplugged */ if (rpt_mode == -1) { rpt_mode = wiimote->state.rpt_mode; } /* Pick a report mode based on report flags */ if ((rpt_mode & CWIID_RPT_EXT) && ((wiimote->state.ext_type == CWIID_EXT_NUNCHUK) || (wiimote->state.ext_type == CWIID_EXT_CLASSIC) || (wiimote->state.ext_type == CWIID_EXT_MOTIONPLUS))) { if ((rpt_mode & CWIID_RPT_IR) && (rpt_mode & CWIID_RPT_ACC)) { rpt_type = RPT_BTN_ACC_IR10_EXT6; ir_enable_seq = ir_enable10_seq; seq_len = SEQ_LEN(ir_enable10_seq); } else if (rpt_mode & CWIID_RPT_IR) { rpt_type = RPT_BTN_IR10_EXT9; ir_enable_seq = ir_enable10_seq; seq_len = SEQ_LEN(ir_enable10_seq); } else if (rpt_mode & CWIID_RPT_ACC) { rpt_type = RPT_BTN_ACC_EXT16; } else if (rpt_mode & CWIID_RPT_BTN) { rpt_type = RPT_BTN_EXT8; } else { rpt_type = RPT_EXT21; } } else if ((rpt_mode & CWIID_RPT_EXT) && wiimote->state.ext_type == CWIID_EXT_BALANCE) { rpt_type = RPT_BTN_EXT8; } else { if (rpt_mode & CWIID_RPT_IR) { rpt_type = RPT_BTN_ACC_IR12; ir_enable_seq = ir_enable12_seq; seq_len = SEQ_LEN(ir_enable12_seq); } else if (rpt_mode & CWIID_RPT_ACC) { rpt_type = RPT_BTN_ACC; } else { rpt_type = RPT_BTN; } } /* Enable IR */ /* TODO: only do this when necessary (record old IR mode) */ if ((rpt_mode & CWIID_RPT_IR)) { if (exec_write_seq(wiimote, seq_len, ir_enable_seq)) { cwiid_err(wiimote, "IR enable error"); return -1; } } /* Disable IR */ else if ((wiimote->state.rpt_mode & CWIID_RPT_IR) && !(rpt_mode & CWIID_RPT_IR)) { if (exec_write_seq(wiimote, SEQ_LEN(ir_disable_seq), ir_disable_seq)) { cwiid_err(wiimote, "IR disable error"); return -1; } } /* Send SET_REPORT */ buf[0] = (wiimote->flags & CWIID_FLAG_CONTINUOUS) ? 0x04 : 0; buf[1] = rpt_type; if (cwiid_send_rpt(wiimote, 0, RPT_RPT_MODE, RPT_MODE_BUF_LEN, buf)) { cwiid_err(wiimote, "Send report error (report mode)"); return -1; } /* clear state for unreported data */ if (CWIID_RPT_BTN & ~rpt_mode & wiimote->state.rpt_mode) { wiimote->state.buttons = 0; } if (CWIID_RPT_ACC & ~rpt_mode & wiimote->state.rpt_mode) { memset(wiimote->state.acc, 0, sizeof wiimote->state.acc); } if (CWIID_RPT_IR & ~rpt_mode & wiimote->state.rpt_mode) { memset(wiimote->state.ir_src, 0, sizeof wiimote->state.ir_src); } if ((wiimote->state.ext_type == CWIID_EXT_NUNCHUK) && (CWIID_RPT_NUNCHUK & ~rpt_mode & wiimote->state.rpt_mode)) { memset(&wiimote->state.ext, 0, sizeof wiimote->state.ext); } else if ((wiimote->state.ext_type == CWIID_EXT_CLASSIC) && (CWIID_RPT_CLASSIC & ~rpt_mode & wiimote->state.rpt_mode)) { memset(&wiimote->state.ext, 0, sizeof wiimote->state.ext); } else if ((wiimote->state.ext_type == CWIID_EXT_BALANCE) && (CWIID_RPT_BALANCE & ~rpt_mode & wiimote->state.rpt_mode)) { memset(&wiimote->state.ext, 0, sizeof wiimote->state.ext); } else if ((wiimote->state.ext_type == CWIID_EXT_MOTIONPLUS) && (CWIID_RPT_MOTIONPLUS & ~rpt_mode & wiimote->state.rpt_mode)) { memset(&wiimote->state.ext, 0, sizeof wiimote->state.ext); } wiimote->state.rpt_mode = rpt_mode; if (pthread_mutex_unlock(&wiimote->rpt_mutex)) { cwiid_err(wiimote, "Mutex unlock error (rpt mutex) - " "deadlock warning"); return -1; } return 0; } cwiid-0.6.00+svn201/libcwiid/Makefile.in0000644000175000017500000000157710742047311016667 0ustar tootstoots#Copyright (C) 2006 L. Donnie Smith include @top_builddir@/defs.mak LIB_NAME = cwiid MAJOR_VER = 1 MINOR_VER = 0 SOURCES = bluetooth.c command.c connect.c interface.c process.c state.c \ thread.c util.c LDLIBS += -lbluetooth -lpthread -lrt LIB_INST_DIR = @libdir@ INC_INST_DIR = @includedir@ DEST_PKG_CONFIG_INST_DIR = $(ROOTDIR)@libdir@/pkgconfig include $(COMMON)/include/lib.mak $(SHARED_LIB): $(SO_NAME) $(LINK_NAME) $(SO_NAME): ln -sf $(SHARED_LIB) $(SO_NAME) $(LINK_NAME): ln -sf $(SO_NAME) $(LINK_NAME) install: install_pkgconfig uninstall: uninstall_pkgconfig install_pkgconfig: install -D -m 644 cwiid.pc $(DEST_PKG_CONFIG_INST_DIR)/cwiid.pc uninstall_pkgconfig: rm -f $(DEST_PKG_CONFIG_INST_DIR)/cwiid.pc clean: remove_links remove_links: rm -f $(SO_NAME) $(LINK_NAME) distclean: clean rm Makefile cwiid.pc .PHONY: distclean clean make_links remove_links cwiid-0.6.00+svn201/libcwiid/process.c0000644000175000017500000002134311227635171016443 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2007-05-16 L. Donnie Smith * * process_err adds error_mesg to mesg_array * * 2007-04-24 L. Donnie Smith * * created for API overhaul (moved from old event.c) */ #include #include "cwiid_internal.h" int process_error(struct wiimote *wiimote, ssize_t len, struct mesg_array *ma) { struct cwiid_error_mesg *error_mesg; error_mesg = &ma->array[ma->count++].error_mesg; error_mesg->type = CWIID_MESG_ERROR; if (len == 0) { error_mesg->error = CWIID_ERROR_DISCONNECT; } else { error_mesg->error = CWIID_ERROR_COMM; } if (cancel_rw(wiimote)) { cwiid_err(wiimote, "RW cancel error"); } return 0; } int process_status(struct wiimote *wiimote, const unsigned char *data, struct mesg_array *ma) { struct cwiid_status_mesg status_mesg; status_mesg.type = CWIID_MESG_STATUS; status_mesg.battery = data[5]; if (data[2] & 0x02) { /* status_thread will figure out what it is */ status_mesg.ext_type = CWIID_EXT_UNKNOWN; } else { status_mesg.ext_type = CWIID_EXT_NONE; } if (write(wiimote->status_pipe[1], &status_mesg, sizeof status_mesg) != sizeof status_mesg) { cwiid_err(wiimote, "Status pipe write error"); return -1; } return 0; } int process_btn(struct wiimote *wiimote, const unsigned char *data, struct mesg_array *ma) { struct cwiid_btn_mesg *btn_mesg; uint16_t buttons; buttons = (data[0] & BTN_MASK_0)<<8 | (data[1] & BTN_MASK_1); if (wiimote->state.rpt_mode & CWIID_RPT_BTN) { if ((wiimote->state.buttons != buttons) || (wiimote->flags & CWIID_FLAG_REPEAT_BTN)) { btn_mesg = &ma->array[ma->count++].btn_mesg; btn_mesg->type = CWIID_MESG_BTN; btn_mesg->buttons = buttons; } } return 0; } int process_acc(struct wiimote *wiimote, const unsigned char *data, struct mesg_array *ma) { struct cwiid_acc_mesg *acc_mesg; if (wiimote->state.rpt_mode & CWIID_RPT_ACC) { acc_mesg = &ma->array[ma->count++].acc_mesg; acc_mesg->type = CWIID_MESG_ACC; acc_mesg->acc[CWIID_X] = data[0]; acc_mesg->acc[CWIID_Y] = data[1]; acc_mesg->acc[CWIID_Z] = data[2]; } return 0; } int process_ir10(struct wiimote *wiimote, const unsigned char *data, struct mesg_array *ma) { struct cwiid_ir_mesg *ir_mesg; int i; const unsigned char *block; if (wiimote->state.rpt_mode & CWIID_RPT_IR) { ir_mesg = &ma->array[ma->count++].ir_mesg; ir_mesg->type = CWIID_MESG_IR; for (i=0, block=data; i < CWIID_IR_SRC_COUNT; i+=2, block+=5) { if (block[0] == 0xFF) { ir_mesg->src[i].valid = 0; } else { ir_mesg->src[i].valid = 1; ir_mesg->src[i].pos[CWIID_X] = ((uint16_t)block[2] & 0x30)<<4 | (uint16_t)block[0]; ir_mesg->src[i].pos[CWIID_Y] = ((uint16_t)block[2] & 0xC0)<<2 | (uint16_t)block[1]; ir_mesg->src[i].size = -1; } if (block[3] == 0xFF) { ir_mesg->src[i+1].valid = 0; } else { ir_mesg->src[i+1].valid = 1; ir_mesg->src[i+1].pos[CWIID_X] = ((uint16_t)block[2] & 0x03)<<8 | (uint16_t)block[3]; ir_mesg->src[i+1].pos[CWIID_Y] = ((uint16_t)block[2] & 0x0C)<<6 | (uint16_t)block[4]; ir_mesg->src[i+1].size = -1; } } } return 0; } int process_ir12(struct wiimote *wiimote, const unsigned char *data, struct mesg_array *ma) { struct cwiid_ir_mesg *ir_mesg; int i; const unsigned char *block; if (wiimote->state.rpt_mode & CWIID_RPT_IR) { ir_mesg = &ma->array[ma->count++].ir_mesg; ir_mesg->type = CWIID_MESG_IR; for (i=0, block=data; i < CWIID_IR_SRC_COUNT; i++, block+=3) { if (block[0] == 0xFF) { ir_mesg->src[i].valid = 0; } else { ir_mesg->src[i].valid = 1; ir_mesg->src[i].pos[CWIID_X] = ((uint16_t)block[2] & 0x30)<<4 | (uint16_t)block[0]; ir_mesg->src[i].pos[CWIID_Y] = ((uint16_t)block[2] & 0xC0)<<2 | (uint16_t)block[1]; ir_mesg->src[i].size = block[2] & 0x0F; } } } return 0; } int process_ext(struct wiimote *wiimote, unsigned char *data, unsigned char len, struct mesg_array *ma) { struct cwiid_nunchuk_mesg *nunchuk_mesg; struct cwiid_classic_mesg *classic_mesg; struct cwiid_balance_mesg *balance_mesg; struct cwiid_motionplus_mesg *motionplus_mesg; int i; switch (wiimote->state.ext_type) { case CWIID_EXT_NONE: cwiid_err(wiimote, "Received unexpected extension report"); break; case CWIID_EXT_UNKNOWN: break; case CWIID_EXT_NUNCHUK: if (wiimote->state.rpt_mode & CWIID_RPT_NUNCHUK) { nunchuk_mesg = &ma->array[ma->count++].nunchuk_mesg; nunchuk_mesg->type = CWIID_MESG_NUNCHUK; nunchuk_mesg->stick[CWIID_X] = data[0]; nunchuk_mesg->stick[CWIID_Y] = data[1]; nunchuk_mesg->acc[CWIID_X] = data[2]; nunchuk_mesg->acc[CWIID_Y] = data[3]; nunchuk_mesg->acc[CWIID_Z] = data[4]; nunchuk_mesg->buttons = ~data[5] & NUNCHUK_BTN_MASK; } break; case CWIID_EXT_CLASSIC: if (wiimote->state.rpt_mode & CWIID_RPT_CLASSIC) { classic_mesg = &ma->array[ma->count++].classic_mesg; classic_mesg->type = CWIID_MESG_CLASSIC; for (i=0; i < 6; i++) { data[i] = data[i]; } classic_mesg->l_stick[CWIID_X] = data[0] & 0x3F; classic_mesg->l_stick[CWIID_Y] = data[1] & 0x3F; classic_mesg->r_stick[CWIID_X] = (data[0] & 0xC0)>>3 | (data[1] & 0xC0)>>5 | (data[2] & 0x80)>>7; classic_mesg->r_stick[CWIID_Y] = data[2] & 0x1F; classic_mesg->l = (data[2] & 0x60)>>2 | (data[3] & 0xE0)>>5; classic_mesg->r = data[3] & 0x1F; classic_mesg->buttons = ~((uint16_t)data[4]<<8 | (uint16_t)data[5]); } break; case CWIID_EXT_BALANCE: if (wiimote->state.rpt_mode & CWIID_RPT_BALANCE) { balance_mesg = &ma->array[ma->count++].balance_mesg; balance_mesg->type = CWIID_MESG_BALANCE; balance_mesg->right_top = ((uint16_t)data[0]<<8 | (uint16_t)data[1]); balance_mesg->right_bottom = ((uint16_t)data[2]<<8 | (uint16_t)data[3]); balance_mesg->left_top = ((uint16_t)data[4]<<8 | (uint16_t)data[5]); balance_mesg->left_bottom = ((uint16_t)data[6]<<8 | (uint16_t)data[7]); } case CWIID_EXT_MOTIONPLUS: if (wiimote->state.rpt_mode & CWIID_RPT_MOTIONPLUS) { motionplus_mesg = &ma->array[ma->count++].motionplus_mesg; motionplus_mesg->type = CWIID_MESG_MOTIONPLUS; motionplus_mesg->angle_rate[CWIID_PHI] = ((uint16_t)data[5] & 0xFC)<<6 | (uint16_t)data[2]; motionplus_mesg->angle_rate[CWIID_THETA] = ((uint16_t)data[4] & 0xFC)<<6 | (uint16_t)data[1]; motionplus_mesg->angle_rate[CWIID_PSI] = ((uint16_t)data[3] & 0xFC)<<6 | (uint16_t)data[0]; } break; } return 0; } int process_read(struct wiimote *wiimote, unsigned char *data) { struct rw_mesg rw_mesg; if (wiimote->rw_status != RW_READ) { cwiid_err(wiimote, "Received unexpected read report"); return -1; } rw_mesg.type = RW_READ; rw_mesg.len = (data[0]>>4)+1; rw_mesg.error = data[0] & 0x0F; memcpy(&rw_mesg.data, data+3, rw_mesg.len); if (write(wiimote->rw_pipe[1], &rw_mesg, sizeof rw_mesg) != sizeof rw_mesg) { cwiid_err(wiimote, "RW pipe write error"); return -1; } return 0; } int process_write(struct wiimote *wiimote, unsigned char *data) { struct rw_mesg rw_mesg; if (wiimote->rw_status != RW_WRITE) { cwiid_err(wiimote, "Received unexpected write report"); return -1; } rw_mesg.type = RW_WRITE; rw_mesg.error = data[0]; if (write(wiimote->rw_pipe[1], &rw_mesg, sizeof rw_mesg) != sizeof rw_mesg) { cwiid_err(wiimote, "RW pipe write error"); return -1; } return 0; } cwiid-0.6.00+svn201/libcwiid/util.c0000644000175000017500000001322011215570367015737 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2008-08-14 L. Donnie Smith * * make cwiid_err_default public * * clean up cwiid_err * * 2007-04-24 L. Donnie Smith * * rewrite for API overhaul * * 2007-04-09 L. Donnie Smith * * renamed wiimote to libcwiid, renamed structures accordingly * * 2007-04-08 Petter Reinholdtsen * * fixed signed/unsigned comparison warning in send_report and * exec_write_seq * * 2007-04-01 L. Donnie Smith * * removed cwiid_findfirst (moved to bluetooth.c) * * 2007-03-27 L. Donnie Smith * * moved cwiid_findfirst to bluetooth.c * * 2007-03-14 L. Donnie Smith * * audited error checking (coda and error handler sections) * * 2007-03-05 L. Donnie Smith * * created cwiid_err_func variable * * created cwiid_err_default * * added wiimote parameter to cwiid_err definition and calls * * 2007-03-01 L. Donnie Smith * * Initial ChangeLog * * type audit (stdint, const, char booleans) */ #include #include #include #include #include #include #include #include #include "cwiid_internal.h" cwiid_err_t cwiid_err_default; static cwiid_err_t *cwiid_err_func = &cwiid_err_default; int cwiid_set_err(cwiid_err_t *err) { /* TODO: assuming pointer assignment is atomic operation */ /* if it is, and the user doesn't care about race conditions, we don't * either */ cwiid_err_func = err; return 0; } void cwiid_err_default(struct wiimote *wiimote, const char *str, va_list ap) { vfprintf(stderr, str, ap); fprintf(stderr, "\n"); } void cwiid_err(struct wiimote *wiimote, const char *str, ...) { va_list ap; if (cwiid_err_func) { va_start(ap, str); (*cwiid_err_func)(wiimote, str, ap); va_end(ap); } } int verify_handshake(struct wiimote *wiimote) { unsigned char handshake; if (read(wiimote->ctl_socket, &handshake, 1) != 1) { cwiid_err(wiimote, "Socket read error (handshake)"); return -1; } else if ((handshake & BT_TRANS_MASK) != BT_TRANS_HANDSHAKE) { cwiid_err(wiimote, "Handshake expected, non-handshake received"); return -1; } else if ((handshake & BT_PARAM_MASK) != BT_PARAM_SUCCESSFUL) { cwiid_err(wiimote, "Non-successful handshake"); return -1; } return 0; } int exec_write_seq(struct wiimote *wiimote, unsigned int len, struct write_seq *seq) { unsigned int i; for (i=0; i < len; i++) { switch (seq[i].type) { case WRITE_SEQ_RPT: if (cwiid_send_rpt(wiimote, seq[i].flags, seq[i].report_offset, seq[i].len, seq[i].data)) { return -1; } break; case WRITE_SEQ_MEM: if (cwiid_write(wiimote, seq[i].flags, seq[i].report_offset, seq[i].len, seq[i].data)) { return -1; } break; } } return 0; } int full_read(int fd, void *buf, size_t len) { ssize_t last_len = 0; do { if ((last_len = read(fd, buf, len)) == -1) { return -1; } len -= last_len; buf += last_len; } while (len > 0); return 0; } int write_mesg_array(struct wiimote *wiimote, struct mesg_array *ma) { ssize_t len = (void *)&ma->array[ma->count] - (void *)ma; int ret = 0; /* This must remain a single write operation to ensure atomicity, * which is required to avoid mutexes and cancellation issues */ if (write(wiimote->mesg_pipe[1], ma, len) != len) { if (errno == EAGAIN) { cwiid_err(wiimote, "Mesg pipe overflow"); if (fcntl(wiimote->mesg_pipe[1], F_SETFL, 0)) { cwiid_err(wiimote, "File control error (mesg pipe)"); ret = -1; } else { if (write(wiimote->mesg_pipe[1], ma, len) != len) { cwiid_err(wiimote, "Pipe write error (mesg pipe)"); ret = -1; } if (fcntl(wiimote->mesg_pipe[1], F_SETFL, O_NONBLOCK)) { cwiid_err(wiimote, "File control error (mesg pipe"); } } } else { cwiid_err(wiimote, "Pipe write error (mesg pipe)"); ret = -1; } } return ret; } int read_mesg_array(int fd, struct mesg_array *ma) { ssize_t len; len = (void *)&ma->array[0] - (void *)ma; if (full_read(fd, ma, len)) { return -1; } len = ma->count * sizeof ma->array[0]; if (full_read(fd, &ma->array[0], len)) { return -1; } return 0; } int cancel_rw(struct wiimote *wiimote) { struct rw_mesg rw_mesg; rw_mesg.type = RW_CANCEL; if (write(wiimote->rw_pipe[1], &rw_mesg, sizeof rw_mesg) != sizeof rw_mesg) { cwiid_err(wiimote, "Pipe write error (rw)"); return -1; } return 0; } int cancel_mesg_callback(struct wiimote *wiimote) { int ret = 0; if (pthread_cancel(wiimote->mesg_callback_thread)) { cwiid_err(wiimote, "Thread cancel error (callback thread)"); ret = -1; } if (pthread_detach(wiimote->mesg_callback_thread)) { cwiid_err(wiimote, "Thread detach error (callback thread)"); ret = -1; } return ret; } cwiid-0.6.00+svn201/libcwiid/thread.c0000644000175000017500000002225111223453733016231 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2007-05-16 L. Donnie Smith * * send error_mesg from process_error * * 2007-05-14 L. Donnie Smith * * added timestamp to message array * * 2007-04-24 L. Donnie Smith * * rewrite for API overhaul (renamed from event.c) * * 2007-04-09 L. Donnie Smith * * renamed wiimote to libcwiid, renamed structures accordingly * * 2007-04-08 L. Donnie Smith * * fixed incompatible pointer warning in process_error * * 2007-04-08 Petter Reinholdtsen * * fixed signed/unsigned comparison error in int_listen * * 2007-04-04 L. Donnie Smith * * implemented process_error to handle socket read errors * * added rw_status triggers to read and write handlers * * 2007-03-14 L. Donnie Smith * * audit error checking * * reorganized file * * moved int_listen read/write code to process_read and process_write * * updated (some/a few) comments * * 2007-03-06 L. Donnie Smith * * added wiimote parameter to cwiid_err calls * * 2007-03-01 L. Donnie Smith * * Initial ChangeLog * * type audit (stdint, const, char booleans) */ #include #include #include #include #include #include #include "cwiid_internal.h" #define READ_BUF_LEN 23 void *router_thread(struct wiimote *wiimote) { unsigned char buf[READ_BUF_LEN]; ssize_t len; struct mesg_array ma; char err, print_clock_err = 1; while (1) { /* Read packet */ len = read(wiimote->int_socket, buf, READ_BUF_LEN); ma.count = 0; if (clock_gettime(CLOCK_REALTIME, &ma.timestamp)) { if (print_clock_err) { cwiid_err(wiimote, "clock_gettime error"); print_clock_err = 0; } } err = 0; if ((len == -1) || (len == 0)) { process_error(wiimote, len, &ma); write_mesg_array(wiimote, &ma); /* Quit! */ break; } else { /* Verify first byte (DATA/INPUT) */ if (buf[0] != (BT_TRANS_DATA | BT_PARAM_INPUT)) { cwiid_err(wiimote, "Invalid packet type"); } /* Main switch */ /* printf("%.2X %.2X %.2X %.2X %.2X %.2X %.2X %.2X\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); printf("%.2X %.2X %.2X %.2X %.2X %.2X %.2X %.2X\n", buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]); printf("%.2X %.2X %.2X %.2X %.2X %.2X %.2X %.2X\n", buf[16], buf[17], buf[18], buf[19], buf[20], buf[21], buf[22], buf[23]); printf("\n"); */ switch (buf[1]) { case RPT_STATUS: err = process_status(wiimote, &buf[2], &ma); break; case RPT_BTN: err = process_btn(wiimote, &buf[2], &ma); break; case RPT_BTN_ACC: err = process_btn(wiimote, &buf[2], &ma) || process_acc(wiimote, &buf[4], &ma); break; case RPT_BTN_EXT8: err = process_btn(wiimote, &buf[2], &ma) || process_ext(wiimote, &buf[4], 8, &ma); break; case RPT_BTN_ACC_IR12: err = process_btn(wiimote, &buf[2], &ma) || process_acc(wiimote, &buf[4], &ma) || process_ir12(wiimote, &buf[7], &ma); break; case RPT_BTN_EXT19: err = process_btn(wiimote, &buf[2], &ma) || process_ext(wiimote, &buf[4], 19, &ma); break; case RPT_BTN_ACC_EXT16: err = process_btn(wiimote, &buf[2], &ma) || process_acc(wiimote, &buf[4], &ma) || process_ext(wiimote, &buf[7], 16, &ma); break; case RPT_BTN_IR10_EXT9: err = process_btn(wiimote, &buf[2], &ma) || process_ir10(wiimote, &buf[4], &ma) || process_ext(wiimote, &buf[14], 9, &ma); break; case RPT_BTN_ACC_IR10_EXT6: err = process_btn(wiimote, &buf[2], &ma) || process_acc(wiimote, &buf[4], &ma) || process_ir10(wiimote, &buf[7], &ma) || process_ext(wiimote, &buf[17], 6, &ma); break; case RPT_EXT21: err = process_ext(wiimote, &buf[2], 21, &ma); break; case RPT_BTN_ACC_IR36_1: case RPT_BTN_ACC_IR36_2: cwiid_err(wiimote, "Unsupported report type received " "(interleaved data)"); err = 1; break; case RPT_READ_DATA: err = process_read(wiimote, &buf[4]) || process_btn(wiimote, &buf[2], &ma); break; case RPT_WRITE_ACK: err = process_write(wiimote, &buf[2]); break; default: cwiid_err(wiimote, "Unknown message type"); err = 1; break; } if (!err && (ma.count > 0)) { if (update_state(wiimote, &ma)) { cwiid_err(wiimote, "State update error"); } if (wiimote->flags & CWIID_FLAG_MESG_IFC) { /* prints its own errors */ write_mesg_array(wiimote, &ma); } } } } return NULL; } void *status_thread(struct wiimote *wiimote) { struct mesg_array ma; struct cwiid_status_mesg *status_mesg; unsigned char buf[2]; ma.count = 1; status_mesg = &ma.array[0].status_mesg; while (1) { if (full_read(wiimote->status_pipe[0], status_mesg, sizeof *status_mesg)) { cwiid_err(wiimote, "Pipe read error (status)"); /* Quit! */ break; } if (status_mesg->type != CWIID_MESG_STATUS) { cwiid_err(wiimote, "Bad message on status pipe"); continue; } if (status_mesg->ext_type == CWIID_EXT_UNKNOWN) { /* Read extension ID */ if (cwiid_read(wiimote, CWIID_RW_REG, 0xA400FE, 1, &buf[0])) { cwiid_err(wiimote, "Read error (extension error)"); status_mesg->ext_type = CWIID_EXT_UNKNOWN; } /* If the extension didn't change, or if the extension is a * MotionPlus, no init necessary */ switch (buf[0]) { case EXT_NONE: status_mesg->ext_type = CWIID_EXT_NONE; break; case EXT_NUNCHUK: status_mesg->ext_type = CWIID_EXT_NUNCHUK; break; case EXT_CLASSIC: status_mesg->ext_type = CWIID_EXT_CLASSIC; break; case EXT_BALANCE: status_mesg->ext_type = CWIID_EXT_BALANCE; break; case EXT_MOTIONPLUS: status_mesg->ext_type = CWIID_EXT_MOTIONPLUS; break; case EXT_PARTIAL: /* Everything (but MotionPlus) shows up as partial until initialized */ buf[0] = 0x55; buf[1] = 0x00; /* Initialize extension register space */ if (cwiid_write(wiimote, CWIID_RW_REG, 0xA400F0, 1, &buf[0])) { cwiid_err(wiimote, "Extension initialization error"); status_mesg->ext_type = CWIID_EXT_UNKNOWN; } else if (cwiid_write(wiimote, CWIID_RW_REG, 0xA400FB, 1, &buf[1])) { cwiid_err(wiimote, "Extension initialization error"); status_mesg->ext_type = CWIID_EXT_UNKNOWN; } /* Read extension ID */ else if (cwiid_read(wiimote, CWIID_RW_REG, 0xA400FE, 1, &buf[0])) { cwiid_err(wiimote, "Read error (extension error)"); status_mesg->ext_type = CWIID_EXT_UNKNOWN; } else { switch (buf[0]) { case EXT_NONE: case EXT_PARTIAL: status_mesg->ext_type = CWIID_EXT_NONE; break; case EXT_NUNCHUK: status_mesg->ext_type = CWIID_EXT_NUNCHUK; break; case EXT_CLASSIC: status_mesg->ext_type = CWIID_EXT_CLASSIC; break; case EXT_BALANCE: status_mesg->ext_type = CWIID_EXT_BALANCE; break; default: status_mesg->ext_type = CWIID_EXT_UNKNOWN; break; } } break; } } if (update_state(wiimote, &ma)) { cwiid_err(wiimote, "State update error"); } if (update_rpt_mode(wiimote, -1)) { cwiid_err(wiimote, "Error reseting report mode"); } if ((wiimote->state.rpt_mode & CWIID_RPT_STATUS) && (wiimote->flags & CWIID_FLAG_MESG_IFC)) { if (write_mesg_array(wiimote, &ma)) { /* prints its own errors */ } } } return NULL; } void *mesg_callback_thread(struct wiimote *wiimote) { int mesg_pipe = wiimote->mesg_pipe[0]; cwiid_mesg_callback_t *callback = wiimote->mesg_callback; struct mesg_array ma; int cancelstate; while (1) { if (read_mesg_array(mesg_pipe, &ma)) { cwiid_err(wiimote, "Mesg pipe read error"); continue; } /* TODO: The callback can still be called once after disconnect, * although it's very unlikely. User must keep track and avoid * accessing the wiimote struct after disconnect. */ if (pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cancelstate)) { cwiid_err(wiimote, "Cancel state disable error (callback thread)"); } callback(wiimote, ma.count, ma.array, &ma.timestamp); if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &cancelstate)) { cwiid_err(wiimote, "Cancel state restore error (callback thread)"); } } return NULL; } cwiid-0.6.00+svn201/libcwiid/cwiid_internal.h0000644000175000017500000001474311223453733017771 0ustar tootstoots/* Copyright (C) 2007 L. Donnie Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * ChangeLog: * 2007-05-16 L. Donnie Smith * * remove error_pipe * * add struct mesg_array to process_error * * 2007-05-14 L. Donnie Smith * * added timestamp to mesg_array * * 2007-04-24 L. Donnie Smith * * rewrite for API overhaul * * 2007-04-09 L. Donnie Smith * * renamed wiimote to libcwiid, renamed structures accordingly * * 2007-04-04 L. Donnie Smith * * moved RW error state to separate member * * 2007-04-01 L. Donnie Smith * * removed CWIID_CMP_LEN macro and cwiid_findfirst prototype * * 2007-03-05 L. Donnie Smith * * added wiimote parameter to cwiid_err prototype * * 2007-03-01 L. Donnie Smith * * Initial ChangeLog * * type audit (stdint, const, char booleans) */ #ifndef CWIID_INTERNAL_H #define CWIID_INTERNAL_H #include #include #include /* ssize_t */ #include "cwiid.h" /* Bluetooth magic numbers */ #define BT_TRANS_MASK 0xF0 #define BT_TRANS_HANDSHAKE 0x00 #define BT_TRANS_SET_REPORT 0x50 #define BT_TRANS_DATA 0xA0 #define BT_TRANS_DATAC 0xB0 #define BT_PARAM_MASK 0x0F /* HANDSHAKE params */ #define BT_PARAM_SUCCESSFUL 0x00 #define BT_PARAM_NOT_READY 0x01 #define BT_PARAM_ERR_INVALID_REPORT_ID 0x02 #define BT_PARAM_ERR_UNSUPPORTED_REQUEST 0x03 #define BT_PARAM_ERR_INVALID_PARAMETER 0x04 #define BT_PARAM_ERR_UNKNOWN 0x0E #define BT_PARAM_ERR_FATAL 0x0F /* SET_REPORT, DATA, DATAC params */ #define BT_PARAM_INPUT 0x01 #define BT_PARAM_OUTPUT 0x02 #define BT_PARAM_FEATURE 0x03 /* Wiimote specific magic numbers */ #define WIIMOTE_NAME "Nintendo RVL-CNT-01" #define WIIBALANCE_NAME "Nintendo RVL-WBC-01" #define WIIMOTE_CLASS_0 0x04 #define WIIMOTE_CLASS_1 0x25 #define WIIMOTE_CLASS_2 0x00 /* Wiimote port/channel/PSMs */ #define CTL_PSM 17 #define INT_PSM 19 /* Report numbers */ #define RPT_LED_RUMBLE 0x11 #define RPT_RPT_MODE 0x12 #define RPT_IR_ENABLE1 0x13 #define RPT_SPEAKER_ENABLE 0x14 #define RPT_STATUS_REQ 0x15 #define RPT_WRITE 0x16 #define RPT_READ_REQ 0x17 #define RPT_SPEAKER_DATA 0x18 #define RPT_SPEAKER_MUTE 0x19 #define RPT_IR_ENABLE2 0x1A #define RPT_STATUS 0x20 #define RPT_READ_DATA 0x21 #define RPT_WRITE_ACK 0x22 #define RPT_BTN 0x30 #define RPT_BTN_ACC 0x31 #define RPT_BTN_EXT8 0x32 #define RPT_BTN_ACC_IR12 0x33 #define RPT_BTN_EXT19 0x34 #define RPT_BTN_ACC_EXT16 0x35 #define RPT_BTN_IR10_EXT9 0x36 #define RPT_BTN_ACC_IR10_EXT6 0x37 #define RPT_EXT21 0x3D #define RPT_BTN_ACC_IR36_1 0x3E #define RPT_BTN_ACC_IR36_2 0x3F /* Button Mask (masks unknown bits in button bytes) */ #define BTN_MASK_0 0x1F #define BTN_MASK_1 0x9F #define NUNCHUK_BTN_MASK 0x03 /* Extension Values */ #define EXT_NONE 0x2E #define EXT_PARTIAL 0xFF #define EXT_NUNCHUK 0x00 #define EXT_CLASSIC 0x01 #define EXT_BALANCE 0x2A #define EXT_MOTIONPLUS 0x04 /* IR Enable blocks */ #define MARCAN_IR_BLOCK_1 "\x00\x00\x00\x00\x00\x00\x90\x00\xC0" #define MARCAN_IR_BLOCK_2 "\x40\x00" #define CLIFF_IR_BLOCK_1 "\x02\x00\x00\x71\x01\x00\xAA\x00\x64" #define CLIFF_IR_BLOCK_2 "\x63\x03" /* Write Sequences */ enum write_seq_type { WRITE_SEQ_RPT, WRITE_SEQ_MEM }; struct write_seq { enum write_seq_type type; uint32_t report_offset; const void *data; uint16_t len; uint8_t flags; }; #define SEQ_LEN(seq) (sizeof(seq)/sizeof(struct write_seq)) /* Message arrays */ struct mesg_array { uint8_t count; struct timespec timestamp; union cwiid_mesg array[CWIID_MAX_MESG_COUNT]; }; /* RW State/Mesg */ enum rw_status { RW_IDLE, RW_READ, RW_WRITE, RW_CANCEL }; struct rw_mesg { enum rw_status type; uint8_t error; uint32_t offset; uint8_t len; char data[16]; }; /* Wiimote struct */ struct wiimote { int flags; int ctl_socket; int int_socket; pthread_t router_thread; pthread_t status_thread; pthread_t mesg_callback_thread; int mesg_pipe[2]; int status_pipe[2]; int rw_pipe[2]; struct cwiid_state state; enum rw_status rw_status; cwiid_mesg_callback_t *mesg_callback; pthread_mutex_t state_mutex; pthread_mutex_t rw_mutex; pthread_mutex_t rpt_mutex; int id; const void *data; }; /* prototypes */ /* thread.c */ void *router_thread(struct wiimote *wiimote); void *status_thread(struct wiimote *wiimote); void *mesg_callback_thread(struct wiimote *wiimote); /* util.c */ void cwiid_err(struct wiimote *wiimote, const char *str, ...); int verify_handshake(struct wiimote *wiimote); int exec_write_seq(struct wiimote *wiimote, unsigned int len, struct write_seq *seq); int full_read(int fd, void *buf, size_t len); int write_mesg_array(struct wiimote *wiimote, struct mesg_array *ma); int read_mesg_array(int fd, struct mesg_array *ma); int cancel_rw(struct wiimote *wiimote); int cancel_mesg_callback(struct wiimote *wiimote); /* process.c */ int process_error(struct wiimote *, ssize_t, struct mesg_array *); int process_status(struct wiimote *, const unsigned char *, struct mesg_array *); int process_btn(struct wiimote *, const unsigned char *, struct mesg_array *); int process_acc(struct wiimote *, const unsigned char *, struct mesg_array *); int process_ir10(struct wiimote *, const unsigned char *, struct mesg_array *); int process_ir12(struct wiimote *, const unsigned char *, struct mesg_array *); int process_ext(struct wiimote *, unsigned char *, unsigned char, struct mesg_array *); int process_read(struct wiimote *, unsigned char *); int process_write(struct wiimote *, unsigned char *); /* state.c */ int update_state(struct wiimote *wiimote, struct mesg_array *ma); int update_rpt_mode(struct wiimote *wiimote, int8_t rpt_mode); #endif cwiid-0.6.00+svn201/ChangeLog0000644000175000017500000003125710664426060014611 0ustar tootstoots2007-08-26 L. Donnie Smith docs * updated wminput man page 2007-08-23 L. Donnie Smith python * fixed libdir install bug 2007-08-14 L. Donnie Smith libcwiid * make cwiid_err_default public wminput * added {c,py}_wiimote_deinit functions * added daemon, quiet, and reconnect options 2007-07-29 L. Donnie Smith wminput * fixed wait forever logic 2007-07-28 L. Donnie Smith configure.ac * added config.h header * added with-python argument and associated logic lswm * added config.h include for sources requiring defs wmgui * added config.h include for sources requiring defs wminput * added config.h include for sources requiring defs * added HAVE_PYTHON tests around all python code 2007-06-28 L. Donnie Smith libcwiid * changed version python * implemented uninstall wminput * rewrote ir_ptr plugin * supress error for nonexistent python plugins 2007-06-18 L. Donnie Smith wminput * revised error messages python * revised error messages and doc strings 2007-06-14 L. Donnie Smith libcwiid * added sleep after cwiid_find_wiimote call python * added --prefix option to install script 2007-06-05 L. Donnie Smith python * removed Wiimote_FromC function * added bdaddr argument to Wiimote.init * overloaded Wiimote.init to accept CObject (existing wiimote), and logic to avoid closing it on dealloc wminput * refactored to isolate plugin logic * now imports python plugins without changing directories 2007-06-01 Nick lswm * reworked command-line options (added standard options, long options) wminput * reworked command-line options (added standard options, long options) 2007-06-01 L. Donnie Smith python * added Wiimote_FromC * exported Wiimote_FromC and ConvertMesgArray as CObjects * added get_acc_cal wminput * added pyplugin.c, pyplugin.h * changed wmplugin_exec prototype (&mesg->mesg) * changed param format (pass pointers) * added python plugin support (experimental) 2007-05-30 L. Donnie Smith configure.ac * added python/Makefile and PYTHON_VERSION variable build system * added ROOTDIR (massaged DESTDIR) python * added directory 2007-05-27 Arthur Peters python * removed set_mesg_callback from methods table 2007-05-16 L. Donnie Smith libcwiid * removed error_pipe * fixed error message reporting * changed cwiid_connect, cwiid_disconnect to cwiid_open, cwiid_close (added macros for backward compatibility) * split cwiid_command into cwiid_request_status, cwiid_set_led, cwiid_set_rumble, cwiid_set_rpt_mode (kept cwiid_command for backward compatibility) wmdemo * updated for function name changes wmgui * updated for function name changes wminput * updated for function name changes 2007-05-14 L. Donnie Smith libcwiid * added timestamp to message interfaces * added cwiid_get_acc_cal wmdemo * updated for timestamp addition wmgui * updated for timestamp addition * use cwiid_get_acc_cal to get acc calibration values wminput * updated for timestamp addition * use cwiid_get_acc_cal to get acc calibration values (acc plugins) 2007-04-24 L. Donnie Smith libcwiid * rewrite (API overhaul) wmdemo * updated for API overhaul wmgui * updated for API overhaul wminput * updated for API overhaul 2007-04-15 wminput * fixed classic controller configuration bug 2007-04-12 L. Donnie Smith libcwiid * streamlined wiimote filter 2007-04-12 Petter Reinholdtsen wmdemo * added command-line WIIMOTE_BDADDR 2007-04-09 L. Donnie Smith libcwiid * renamed from libwiimote * renamed external data structures lswm * updated for libcwiid rename wmdemo * updated for libcwiid rename wmgui * updated for libcwiid rename wminput * updated for libcwiid rename 2007-04-08 Arthur Peters wminput * added debounce and low-pass filter to ir_ptr plugin * added low-pass filter to acc plugin 2007-04-08 L. Donnie Smith defs.mak * added DEBUGFLAGS variable wiimote * fixed incompatible pointer warning in process_error wmgui * fixed signed/unsigned comparison warning in btnRead_clicked wminput * fixed signed/unsigned comparison warning in uinput_open and get_plugin * copied acc low-pass filter to nunchuk_acc * removed path from default config symlink target * added plugins parameters (added lex and parse rules, conf functions, wmplugin_param_info struct, updated README) * initialized param info in ir_ptr, nunchuk_acc, and acc plugins * created Scale params in nunchuk_acc and acc plugins * set Scale params for neverball config 2007-04-08 Petter Reinholdtsen defs.mak * created WARNFLAGS variable * added -W to WARNFLAGS wiimote * fixed signed/unsigned comparison warning in int_listen, send_report, and exec_write_seq 2007-04-07 L. Donnie Smith wiimote * changed wiimote_info.class to btclass 2007-04-03 L. Donnie Smith configure.ac * removed --noyywrap from lex wiimote * added queue_flush * reimplemented queue_queue with queue_flush * added wiimote_mesg_error message type * moved RW error state to separate wiimote member * updated wiimote_read and wiimote_write to trigger and detect rw_error * cancel rw operations from wiimote_disconnect * implemented process_error to handle socket read errors * added rw_status triggers to read and write handlers wmdemo * made wiimote handle global * disconnect and exit on wiimote_mesg_error wmgui * disconnect on wiimote_mesg_error wminput * exit on wiimote_mesg_error 2007-04-03 L. Donnie Smith wiimote * fixed wiimote_find_wiimote seg fault wmgui * commented custom wiimote_err (causing Xlib errors) wminput * added stdio.h include to conf.h 2007-04-02 L. Donnie Smith wiimote * fixed exception handling bugs in bluetooth.c wminput * added wait option 2007-04-01 L. Donnie Smith * Moved defs.mak.in to top level directory * Added directories to defs.mak.in * Moved CFLAGS directories from defs.mak to Makefiles * simplified make install deps lswm * created app wmdemo * renamed main.c to wmdemo.c * updated for wiimote_connect change * clarified status output menu item, added status request wmgui * updated for wiimote_connect change wminput * updated for wiimote_connect change wiimote * created bluetooth.c * moved wiimote_findfirst to bluetooth.c, renamed to wiimote_find_wiimote, added timeout argument * defined struct wiimote_info * wrote wiimote_get_info_array * wiimote_connect now takes a pointer to bdaddr_t 2007-03-27 L. Donnie Smith * Added DESTDIR variable to make system 2007-03-23 L. Donnie Smith * Corrected installation directory creation logic * Added .NOTPARALLEL to top level Makefile 2007-03-19 L. Donnie Smith * Added --disable-ldconfig option to configure * Makefiles - append to rather than set compiler options 2007-03-15 L. Donnie Smith wminput * action_enum.awk - explicitly call awk rather than #! /usr/bin/awk 2007-03-14 L. Donnie Smith wiimote * audited error checking (coda and error handler sections) * updated comments * event.c - moved int_listen read/write code to process_read and process_write, reorganized file * wiimote_read - changed to obey decode flag only for register read * wiimote_connect - changed memcpy to bacmp 2007-03-08 L. Donnie Smith * added explicit creation of installation directories to prevent installation errors wiimote * created wiimote_err_t function type * created wiimote_set_err function * added wiimote parameter to wiimote_err calls wmdemo * added implementation of wiimote_err_t, wiimote_set_err 2007-03-05 L. Donnie Smith * Type audit - boolean ints, const strings where appropriate, stdint.h wiimote types * Changed email addresses to cwiid@abstrakraft.org * Added file ChangeLogs * Fixed GTK_{CFLAGS,LIBS} in configure.ac and wmgui/Makefile.in 2007-03-01 L. Donnie Smith * configure.ac - check for stdint.h 2007-02-26 L. Donnie Smith * Changed installation directories to comply with FHS standard * Added check for yypop_buffer_state in flex * Various minor documentation changes * Lowercased "cwiid" in filenames wiimote * added 'static' to local function declarations wminput * added filenames and correct location tracking to parser error messages * added 'static' to local function declarations (plugins) 2007-02-21 Romain Beauxis wminput * fixed help message 2007-02-18 L. Donnie Smith wiimote * fixed wiimote_status_mesg allocation size * changed wiimote_log to wiimote_err with format string and args * reworked event/callback system to pass arrays of (simultaneous) messages * added extern "C" declaration to wiimote.h for c++ programs * added wiimote_t * to wiimote_mesg_t callback prototype (to facilitate using the same callback for multiple wiimotes) wmdemo * added wmgui * Added parent argument to message function wminput * rewrite: new configuration syntax, plugin architecture 2007-01-25 L. Donnie Smith wiimote * added rpt_mode_flag lock to prevent race condition * extended write sequences to simplify multi-part operations wmgui * added status request at connect to populate status boxes 2007-01-24 L. Donnie Smith Added uninstall make target wiimote * macros renamed (should be last rename of public macros) * added status, nunchuk, and classic controller messages * added intelligent report mode selection wmgui * changed button widgets * added nunchuk and classic controller support wminput * fixed command-line bug * updated for wiimote updates * changes to plugin architecture - gives greater access to plugin * added LED indicators to default (IR) tracking 2007-01-16 L. Donnie Smith wminput * fixed build error in plugins directory 2007-01-15 L. Donnie Smith reworked build system, now using autoconf wiimote * fixed bug in IR report data extraction * created acc_ir client message * make install now installs library and header to /usr/local wmif * removed wmgui * reworked GUI * added force, roll and pitch displays * removed AutoMake * split wiimote_callback into separate functions * rewrote command-line parsing * added WIIMOTE_BDADDR environment variable lookup wminput * split wiimote_callback into separate functions * cleaned up cursor tracking * renamed wminput.c to main.c * rewrote command-line parsing * added WIIMOTE_BDADDR environment variable lookup * created plugin architecture and acc plugin 2007-01-09 L. Donnie Smith reworked top-level Makefile bins install to /usr/local/bin on make install wiimote * Changes to message dispatch thread to isolate main thread from dispatch timing issues (especially GTK apps) wmif * fixed --help bug wmgui * fixed --help bug * added g_thread_support test before g_thread_init wminput * fixed --help bug * added #ifdef tests around KEY_ macros in key_enum.{c,awk} 2007-01-04 L. Donnie Smith wiimote * put mesg callback data in a union * fixed write flood error (wait for ACK after each packet) * added IR reporting (mode 0x33 only) * moved internal definitions from wiimote.h into wiimote_internal.h (struct wiimote is now opaque) * wiimote_connect now returns a wiimote_t * * sends button message only when button status changes wmif * updated for wiimote changes wmgui * updated for wiimote changes * enabled IR widgets wminput * added to package 2006-12-31 L. Donnie Smith wiimote * changed various macro names and parameter types (mostly signed to unsigned) * cleaned up LED & RUMBLE command logic * added ACC reporting * added data read/write * created dispatch thread (isolates bluetooth read from app callbacks) * reset report mode after receive status report wmif * updated for wiimote changes * added EEPROM read menu option wmgui * updated for wiimote changes * added ACC output * added data read/write * added IR data widgets (not yet enabled) 2006-12-28 L. Donnie Smith Initial release cwiid-0.6.00+svn201/COPYING0000644000175000017500000004312210567071413014064 0ustar tootstoots GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. cwiid-0.6.00+svn201/wminput/0000755000175000017500000000000011260043516014524 5ustar tootstootscwiid-0.6.00+svn201/wminput/configs/0000755000175000017500000000000011260043406016152 5ustar tootstootscwiid-0.6.00+svn201/wminput/configs/gamepad0000644000175000017500000000062610567071413017507 0ustar tootstoots# gameport Classic.Dpad.X = ABS_X Classic.Dpad.Y = ABS_Y Classic.LStick.X = ABS_HAT0X Classic.LStick.Y = ABS_HAT0Y Classic.RStick.X = ABS_HAT1X Classic.RStick.Y = ABS_HAT1Y Classic.A = BTN_A Classic.B = BTN_B Classic.X = BTN_X Classic.Y = BTN_Y Classic.Minus = BTN_SELECT Classic.Plus = BTN_START Classic.Home = BTN_MODE Classic.L = BTN_TL Classic.R = BTN_TR Classic.ZL = BTN_TL2 Classic.ZR = BTN_TR2 cwiid-0.6.00+svn201/wminput/configs/nunchuk_stick2btn0000644000175000017500000000073011030247111021525 0ustar tootstoots# Fps config for wminput by kyrlian # needs plugins ir_fps and nunchuk_kb # available from http://kyrlian.free.fr/binaries/cwiid/latest/ # wminput source and info at http://abstrakraft.org/cwiid/ include buttons Nunchuk.C = KEY_C Nunchuk.Z = KEY_SPACE #plugin for nunchuk stick Plugin.nunchuk_stick2btn.Up = KEY_UP Plugin.nunchuk_stick2btn.Down = KEY_DOWN Plugin.nunchuk_stick2btn.Left = KEY_LEFT Plugin.nunchuk_stick2btn.Right = KEY_RIGHT cwiid-0.6.00+svn201/wminput/configs/ir_ptr0000644000175000017500000000011410606333650017376 0ustar tootstoots#ir_ptr include buttons Plugin.ir_ptr.X = ~ABS_X Plugin.ir_ptr.Y = ~ABS_Y cwiid-0.6.00+svn201/wminput/configs/acc_led0000644000175000017500000000057211030240567017455 0ustar tootstoots#acc_led include buttons Plugin.acc.X = REL_X Plugin.acc.Y = REL_Y # You can set Plugin.led.Led[1->4] to 1 # to have that led be active all the time Plugin.led.Led4 = 1 # Setting battery to 1 enables the battery check function # By default the keypress is A + B # You can change this by setting Plugin.led.Button to any # wiimote or attachment button Plugin.led.Battery = 1 cwiid-0.6.00+svn201/wminput/configs/acc_ptr0000644000175000017500000000010510606333650017512 0ustar tootstoots#acc_ptr include buttons Plugin.acc.X = REL_X Plugin.acc.Y = REL_Y cwiid-0.6.00+svn201/wminput/configs/neverball0000644000175000017500000000017010606333650020053 0ustar tootstoots# neverball Plugin.acc.Roll = ABS_X Plugin.acc.Roll_Scale = 2.0 Plugin.acc.Pitch = -ABS_Y Plugin.acc.Pitch_Scale = 2.0 cwiid-0.6.00+svn201/wminput/configs/nunchuk_acc_ptr0000644000175000017500000000013510606333650021250 0ustar tootstoots#nunchuk_acc_ptr include buttons Plugin.nunchuk_acc.X = REL_X Plugin.nunchuk_acc.Y = REL_Y cwiid-0.6.00+svn201/wminput/configs/buttons0000644000175000017500000000116310606333650017602 0ustar tootstoots#buttons Wiimote.A = BTN_LEFT Wiimote.B = BTN_RIGHT Wiimote.Up = KEY_UP Wiimote.Down = KEY_DOWN Wiimote.Left = KEY_LEFT Wiimote.Right = KEY_RIGHT Wiimote.Minus = KEY_BACK Wiimote.Plus = KEY_FORWARD Wiimote.Home = KEY_HOME Wiimote.1 = KEY_PROG1 Wiimote.2 = KEY_PROG2 Nunchuk.C = BTN_LEFT Nunchuk.Z = BTN_RIGHT Classic.Up = KEY_UP Classic.Down = KEY_DOWN Classic.Left = KEY_LEFT Classic.Right = KEY_RIGHT Classic.Minus = KEY_BACK Classic.Plus = KEY_FORWARD Classic.Home = KEY_HOME Classic.A = BTN_LEFT Classic.B = BTN_RIGHT #Classic.X = #Classic.Y = #Classic.ZL = #Classic.ZR = #Classic.L = #Classic.R = cwiid-0.6.00+svn201/wminput/README0000644000175000017500000001664510641062542015422 0ustar tootstootsCopyright (C) 2007 L. Donnie Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA OVERVIEW ------------------------------------------------------------------------------------------------ wminput is an Linux event, mouse, and joystick driver for the wiimote using the uinput system. It supports assigning key/button symbols to buttons on the wiimote, nunchuk, and classic controller, and axes symbols to wiimote axes including direction pads, "analog" sticks, and "analog" shoulder buttons. Furthermore, it provides a plugin interface through which more advanced functionality can be implemented, such as accelerometer and ir calculations. Plugins can provide button-type events and axes. EXECUTION ------------------------------------------------------------------------------------------------ wminput [-h] [-w] [-c config] [bdaddr] -h: print usage and exit -w: on startup, wait (without timing out) until a wiimote is found -c config: specifies the configuration file to load. "default" is the default configuration file (on install, a symlink is created to the acc_ptr configuration. The search directories are specified below in the section on configuration files, or an absolute or relative pathname may be given. bdaddr: specifies the bluetooth device address of the wiimote. If unspecified, the environment variable WIIMOTE_BDADDR is used. If this variable does not exist, a connection is made with the first wiimote found. CONFIGURATION REQUIREMENTS ------------------------------------------------------------------------------------------------ uinput kernel support is required. joydev and evdev are required for joystick and event interfaces, respectively. See http://gentoo-wiki.com/HOWTO_Compile_a_Kernel_Manually for information on kernel compilation. By default, some (most? all?) udev configurations set up a uinput device file readable only by root. Using wminput as a user other than root requires udev to change the permissions on uinput. Place the following line in a file in /etc/udev/rules.d (see the documentation for your distro for the recommended file for local rules) to allow anyone on the system to use uinput: KERNEL=="uinput", MODE="0666" A more secure method uses the following line to allow anyone in to use wminput, and adds only the desired users to : KERNEL=="uinput", GROUP="" A uinput group can be created specifically for this purpose, or an existing group such as wheel can be used. Key symbols can be assigned to wminput button events. While standard keys are supported by X by default, non-standard key symbols, and mapping actions to those symbols, is not automatic. An excellent tutorial at http://gentoo-wiki.com/HOWTO_Use_Multimedia_Keys can help you set this up. An overview of the process described there: 1.Assign the key symbol in question to a button in a wminput configuration file. 2.Use wminput and the wiimote to generate that key symbol, using xev to find out if the key symbol is already mapped, and find the key code if it is not. 3.If the code is not mapped to the appropriate symbol, edit ~/.Xmodmap, and use xmodmap to map them. (A copy of my ~/.Xmodmap is included in cwiid/doc) 4.Use xbindkeys or a window manager-specific utility to map the key symbols to specific actions. Wiimote buttons can be mapped to modifier keys (control, shift, alt, etc.) with the command xmodmap command 'add [mod] = [keysym]', where keysym is the key symbol mapped in the process described above, and mod is one of the modifier names listed by 'xmodmap -pm' (mod1 = alt). CONFIGURATION FILES ------------------------------------------------------------------------------------------------ Configuration files are installed in /usr/local/etc/cwiid/wminput. Configuration search directory order is ~/.cwiid/wminput, /usr/local/etc/cwiid/wminput. Configuration files specify the mapping of button and key symbols to wiimote buttons, and axis symbols to wiimote axes. The grammar is as follows (words in angle brackets are to be replaced by appropriate values or strings, without the brackets): # Comment include Include the file specified by inc_file. Wiimote.