Skip to content

Commit 49e0132

Browse files
abstrakraftdsmith
authored and
dsmith
committed
merged branches/dev into trunk
git-svn-id: http://abstrakraft.org/cwiid/svn/trunk@125 918edb2d-ff29-0410-9de2-eb38e7f22bc7
1 parent a09a4ee commit 49e0132

30 files changed

+2378
-213
lines changed

ChangeLog

+44
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
2007-06-05 L. Donnie Smith <cwiid@abstrakraft.org>
2+
python
3+
* removed Wiimote_FromC function
4+
* added bdaddr argument to Wiimote.init
5+
* overloaded Wiimote.init to accept CObject (existing wiimote),
6+
and logic to avoid closing it on dealloc
7+
8+
wminput
9+
* refactored to isolate plugin logic
10+
* now imports python plugins without changing directories
11+
12+
2007-06-01 Nick <nickishappy@gmail.com>
13+
lswm
14+
* reworked command-line options (added standard options, long options)
15+
16+
wminput
17+
* reworked command-line options (added standard options, long options)
18+
19+
2007-06-01 L. Donnie Smith <cwiid@abstrakraft.org>
20+
python
21+
* added Wiimote_FromC
22+
* exported Wiimote_FromC and ConvertMesgArray as CObjects
23+
* added get_acc_cal
24+
25+
wminput
26+
* added pyplugin.c, pyplugin.h
27+
* changed wmplugin_exec prototype (&mesg->mesg)
28+
* changed param format (pass pointers)
29+
* added python plugin support (experimental)
30+
31+
2007-05-30 L. Donnie Smith <cwiid@abstrakraft.org>
32+
configure.ac
33+
* added python/Makefile and PYTHON_VERSION variable
34+
35+
build system
36+
* added ROOTDIR (massaged DESTDIR)
37+
38+
python
39+
* added directory
40+
41+
2007-05-27 Arthur Peters <amp@singingwizard.org>
42+
python
43+
* removed set_mesg_callback from methods table
44+
145
2007-05-16 L. Donnie Smith <cwiid@abstrakraft.org>
246
libcwiid
347
* removed error_pipe

Makefile.in

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,29 @@ include @top_builddir@/defs.mak
55
LIB_DIRS = libcwiid
66
BIN_DIRS = wmgui wminput lswm
77
DOC_DIRS = man doc
8+
BIND_DIRS = python
9+
10+
SUB_DIRS = $(LIB_DIRS) $(BIN_DIRS) $(DOC_DIRS) $(BIND_DIRS) wmdemo
811

912
all install clean distclean uninstall: TARGET += $(MAKECMDGOALS)
1013

11-
all install clean distclean uninstall: $(BIN_DIRS) $(LIB_DIRS)
14+
all install clean distclean uninstall: $(BIN_DIRS) $(LIB_DIRS) $(BIND_DIRS)
1215

1316
install uninstall distclean: $(DOC_DIRS)
1417

1518
all clean distclean: wmdemo
1619

1720
ifneq ($(MAKECMDGOALS),clean)
1821
ifneq ($(MAKECMDGOALS),distclean)
19-
$(BIN_DIRS): $(LIB_DIRS)
22+
$(BIN_DIRS) $(BIND_DIRS): $(LIB_DIRS)
2023
endif
2124
endif
2225

2326
ifeq ($(MAKECMDGOALS),install)
2427
$(BIN_DIRS) $(LIB_DIRS): $(CWIID_CONFIG_DIR) $(CWIID_PLUGINS_DIR)
2528
endif
2629

27-
$(LIB_DIRS) $(BIN_DIRS) $(DOC_DIRS) wmdemo:
30+
$(SUB_DIRS):
2831
$(MAKE) $(TARGET) -C $@
2932

3033
$(CWIID_CONFIG_DIR):
@@ -43,7 +46,6 @@ uninstall:
4346
uninstall_config:
4447
rm -rf $(CWIID_CONFIG_DIR)
4548

46-
.PHONY: all install clean distclean uninstall uninstall_config $(LIB_DIRS) \
47-
$(BIN_DIRS) $(DOC_DIRS) wmdemo
49+
.PHONY: all install clean distclean uninstall uninstall_config $(SUB_DIRS)
4850

4951
.NOTPARALLEL:

common/include/app.mak

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DEPS = $(SOURCES:.c=.d)
55

66
INST_DIR ?= /usr/local/bin
77

8-
DEST_INST_DIR = $(DESTDIR)/$(INST_DIR)
8+
DEST_INST_DIR = $(ROOTDIR)$(INST_DIR)
99

1010
all: $(APP_NAME)
1111

common/include/lib.mak.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ STATIC_LIB = lib$(LIB_NAME).a
77
LINK_NAME = lib$(LIB_NAME).so
88
SO_NAME = $(LINK_NAME).$(MAJOR_VER)
99
SHARED_LIB = $(SO_NAME).$(MINOR_VER)
10-
DEST_INC_INST_DIR = $(DESTDIR)/$(INC_INST_DIR)
11-
DEST_LIB_INST_DIR = $(DESTDIR)/$(LIB_INST_DIR)
10+
DEST_INC_INST_DIR = $(ROOTDIR)$(INC_INST_DIR)
11+
DEST_LIB_INST_DIR = $(ROOTDIR)$(LIB_INST_DIR)
1212

1313
OBJECTS = $(SOURCES:.c=.o)
1414
DEPS = $(SOURCES:.c=.d)

common/include/plugin.mak

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ DEPS = $(SOURCES:.c=.d)
77

88
CFLAGS += -fpic
99

10-
#TODO:unify the way DESTDIR is handled
11-
#Currently, defs.mak adds DESTDIR to the plugin INST_DIR,
10+
#TODO:unify the way ROOTDIR is handled
11+
#Currently, defs.mak adds ROOTDIR to the plugin INST_DIR,
1212
#so we don't do it here
13-
#DEST_INST_DIR = $(DESTDIR)/$(INST_DIR)
13+
#DEST_INST_DIR = $(ROOTDIR)/$(INST_DIR)
1414
DEST_INST_DIR = $(INST_DIR)
1515

1616
all: $(LIB_NAME)

configure.ac

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# ChangeLog:
2+
# 2007-05-30 L. Donnie Smith <cwiid@abstrakraft.org>
3+
# * added python/Makefile
4+
# * added PYTHON_VERSION variable
5+
#
26
# 2007-04-09 L. Donnie Smith <cwiid@abstrakraft.org>
37
# * updated for libcwiid rename
48
#
@@ -32,6 +36,9 @@ if test "$YACC" != "bison -y"; then
3236
AC_MSG_ERROR([bison not found])
3337
fi
3438

39+
PYTHON_VERSION=[`python -c 'import sys; print sys.version[:3]'`]
40+
AC_SUBST(PYTHON_VERSION)
41+
3542
AC_CHECK_LIB([pthread], [pthread_create],,
3643
AC_MSG_ERROR([pthread library not found]))
3744
AC_CHECK_LIB([bluetooth], [hci_devid],,
@@ -104,5 +111,6 @@ AC_OUTPUT(
104111
[wminput/plugins/acc/Makefile]
105112
[wminput/plugins/nunchuk_acc/Makefile]
106113
[lswm/Makefile]
114+
[python/Makefile]
107115
)
108116

defs.mak.in

+6-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ YACC = @YACC@
2323

2424
COMMON = @abs_top_builddir@/common
2525

26-
CWIID_CONFIG_DIR = $(DESTDIR)/@CWIID_CONFIG_DIR@
27-
CWIID_PLUGINS_DIR = $(DESTDIR)/@CWIID_PLUGINS_DIR@
26+
ifdef DESTDIR
27+
ROOTDIR = $(DESTDIR:%/=%)
28+
endif
29+
30+
CWIID_CONFIG_DIR = $(ROOTDIR)@CWIID_CONFIG_DIR@
31+
CWIID_PLUGINS_DIR = $(ROOTDIR)@CWIID_PLUGINS_DIR@
2832

2933
DEBUGFLAGS = -g
3034
WARNFLAGS = -Wall -W

doc/Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include @top_builddir@/defs.mak
44

55
docfiles = Xmodmap wminput.list
66

7-
DEST_DOC_DIR = $(DESTDIR)/$(docdir)
7+
DEST_DOC_DIR = $(ROOTDIR)$(docdir)
88

99
all:
1010

lswm/Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ APP_NAME = lswm
66

77
SOURCES = lswm.c
88

9-
CFLAGS += -I@top_builddir@/libcwiid
9+
CFLAGS += -I@top_builddir@/libcwiid -DCWIID_VERSION=\"${PACKAGE_VERSION}\"
1010
LDFLAGS += -L@top_builddir@/libcwiid
1111
LDLIBS += -lcwiid
1212
INST_DIR = @bindir@

lswm/lswm.c

+39-14
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1616
*
1717
* ChangeLog:
18+
* 2007-06-01 Nick <nickishappy@gmail.com>
19+
* * reworked command-line options (added standard options, long options)
20+
*
1821
* 2007-04-09 L. Donnie Smith <cwiid@abstrakraft.org>
1922
* * updated for libcwiid rename
2023
*
@@ -31,15 +34,19 @@
3134
#include <unistd.h>
3235
#include <bluetooth/bluetooth.h>
3336
#include <cwiid.h>
37+
#include <getopt.h>
3438

35-
#define OPTSTRING "ahlq"
36-
37-
#define USAGE \
38-
"%s [OPTIONS]\n" \
39-
" -a list all bluetooth devices (not just wiimotes)\n" \
40-
" -h print this help message\n" \
41-
" -l long format (device details)\n" \
42-
" -q quiet mode\n"
39+
void print_usage(void)
40+
{
41+
printf("lswm lists availiable wiimotes\n");
42+
printf("Usage: %s [OPTIONS]...\n\n", "lswm");
43+
printf("Options:\n");
44+
printf("\t-h, --help\t\tPrints this output.\n");
45+
printf("\t-v, --version\t\toutput version information and exit.\n");
46+
printf("\t-l, --long\t\tlong format (device details).\n");
47+
printf("\t-q, --quiet\t\tquiet mode (less verbose).\n");
48+
printf("\t-a, --all\t\tlist all bluetooth devices (not just wiimotes).\n");
49+
}
4350

4451
int main(int argc, char *argv[])
4552
{
@@ -53,10 +60,27 @@ int main(int argc, char *argv[])
5360
char ba_str[18];
5461

5562
/* Parse options */
56-
while ((c = getopt(argc, argv, OPTSTRING)) != -1) {
63+
while (1) {
64+
int option_index = 0;
65+
66+
static struct option long_options[] = {
67+
{"help", 0, 0, 'h'},
68+
{"all", 0, 0, 'a'},
69+
{"long", 0, 0, 'l'},
70+
{"version", 0, 0, 'v'},
71+
{"quiet", 0, 0, 'q'},
72+
{0, 0, 0, 0}
73+
};
74+
75+
c = getopt_long(argc, argv, "halvq", long_options, &option_index);
76+
77+
if (c == -1) {
78+
break;
79+
}
80+
5781
switch (c) {
5882
case 'h':
59-
printf(USAGE, argv[0]);
83+
print_usage();
6084
return 0;
6185
break;
6286
case 'a':
@@ -65,19 +89,21 @@ int main(int argc, char *argv[])
6589
case 'l':
6690
long_format = 1;
6791
break;
92+
case 'v':
93+
printf("CWiid Version %s\n", CWIID_VERSION);
94+
return 0;
95+
break;
6896
case 'q':
6997
quiet = 1;
7098
break;
7199
case '?':
72100
default:
73-
fprintf(stderr, "Try '%s -h' for more information\n", argv[0]);
101+
fprintf(stderr, "Try '%s --help' for more information\n", argv[0]);
74102
return -1;
75103
break;
76104
}
77105
}
78106

79-
/* TODO: check for other stuff on the command-line? */
80-
81107
/* Handle quiet mode */
82108
if (quiet) {
83109
cwiid_set_err(NULL);
@@ -111,4 +137,3 @@ int main(int argc, char *argv[])
111137

112138
return 0;
113139
}
114-

man/Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
include @top_builddir@/defs.mak
44

5-
DEST_MAN_DIR = $(DESTDIR)/$(mandir)
5+
DEST_MAN_DIR = $(ROOTDIR)$(mandir)
66

77
all:
88

python/Makefile.in

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#Copyright (C) 2007 Justin M. Tulloss
2+
3+
#TODO: Fix /usr/local path issue
4+
5+
include @top_builddir@/defs.mak
6+
7+
ifdef ROOTDIR
8+
SET_ROOT_DIR = "--root=$(ROOTDIR)"
9+
endif
10+
11+
all:
12+
python setup.py build_ext $(DEBUGFLAGS) -I@top_builddir@/libcwiid -L@top_builddir@/libcwiid -lcwiid
13+
14+
install:
15+
python setup.py install $(SET_ROOT_DIR)
16+
17+
uninstall:
18+
19+
clean:
20+
rm -rf build
21+
22+
distclean: clean
23+
rm Makefile
24+
25+
.PHONY: all install uninstall clean distclean

0 commit comments

Comments
 (0)