Skip to content

Commit 67f4fc4

Browse files
author
mmauka
committed
Add build for OpenWrt package
Fix README Fix openwrt hotplug
1 parent f85d8a1 commit 67f4fc4

File tree

6 files changed

+76
-24
lines changed

6 files changed

+76
-24
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ depcomp
1212
missing
1313
aclocal.m4
1414
Makefile
15+
!opkg/Makefile
1516
Makefile.in
1617
config.h*
1718
configure

Makefile.am

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ bin_PROGRAMS = mochad
22
mochad_SOURCES = mochad.c decode.c encode.c global.c x10state.c x10_write.c \
33
decode.h encode.h global.h x10state.h x10_write.h
44
EXTRA_DIST = udev/91-usb-x10-controllers.rules hotplug2/20-usb-x10 hotplug2/mochad \
5-
cgi/x10.pl cgi/netcat.pl cgi/getsensors.pl cgi/cgi-lib.pl mochamon.pl
5+
cgi/x10.pl cgi/netcat.pl cgi/getsensors.pl cgi/cgi-lib.pl mochamon.pl \
6+
opkg/Makefile
67

78
install-exec-hook:
89
if test -d /etc/udev/rules.d ; then \

Makefile.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ mochad_SOURCES = mochad.c decode.c encode.c global.c x10state.c x10_write.c \
165165
decode.h encode.h global.h x10state.h x10_write.h
166166

167167
EXTRA_DIST = udev/91-usb-x10-controllers.rules hotplug2/20-usb-x10 hotplug2/mochad \
168-
cgi/x10.pl cgi/netcat.pl cgi/getsensors.pl cgi/cgi-lib.pl mochamon.pl
168+
cgi/x10.pl cgi/netcat.pl cgi/getsensors.pl cgi/cgi-lib.pl mochamon.pl \
169+
opkg/Makefile
169170

170171
all: all-am
171172

README

+30-21
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,27 @@ mochad stands for Multiple Online Controllers for Home Automation Daemon.
55

66
== Build it
77

8-
make builds mochad on Ubuntu 10.04 and 10.10. The libusb-1.0 development files
9-
are required. To install,
8+
mochad compiles and runs on Ubuntu 10.04 and 10.10. The libusb-1.0 development
9+
files are required. To install,
1010

1111
sudo apt-get install libusb-1.0-0-dev
1212

13-
Building for embedded platforms such as OpenWrt is TBD.
13+
The usual pattern for building the code applies.
1414

15-
== Run it
15+
tar xzf mochad-...tar.gz
16+
cd mochad-...
17+
./configure
18+
make
19+
sudo make install
20+
21+
Please see http://sourceforge.net/apps/mediawiki/mochad/index.php?title=Main_Page
22+
for details on building for OpenWrt.
1623

17-
Connect CM15A or CM19A.
24+
== Run it
1825

19-
Run mochad as root (that is, sudo ./mochad). mochad will detach from the
20-
terminal and continue to run in the background. The only command line option so
21-
far is -d which will cause mochad to run in the foreground and produce debug
22-
output.
26+
Plugging a CM15A or CM19A should launch mochad. There no need to run mochad
27+
by hand or run it from /etc/rc.local. mochad is launched by a udev rule that
28+
matches the CM15A and CM19A USB vendor and product ID codes.
2329

2430
== Use it
2531

@@ -39,18 +45,18 @@ which remotes work from various locations.
3945

4046
Sample output:
4147

42-
12/07 20:49:10 Rx RF HouseUnit: C3 Func: Off
43-
12/07 20:49:10 Tx PL HouseUnit: C3
44-
12/07 20:49:10 Tx PL House: C Func: Off
45-
12/07 20:49:10 Rx RF HouseUnit: C3 Func: Off
46-
12/07 20:49:10 Tx PL HouseUnit: C3
47-
12/07 20:49:10 Tx PL House: C Func: Off
48-
12/07 20:49:17 Rx RFSEC Addr: 0x11 Func: Lights_Off_SH624
49-
12/07 20:49:17 Rx RFSEC Addr: 0x11 Func: Lights_Off_SH624
50-
12/07 20:49:37 Rx RFSEC Addr: C6:1B:00 Func: Motion_alert_MS10A
51-
12/07 20:49:37 Rx RFSEC Addr: C6:1B:00 Func: Motion_alert_MS10A
52-
12/07 20:49:37 Rx RFSEC Addr: C6:1B:00 Func: Motion_alert_MS10A
53-
12/07 20:49:37 Rx RFSEC Addr: C6:1B:00 Func: Motion_alert_MS10A
48+
12/07 20:49:10 Rx RF HouseUnit: C3 Func: Off
49+
12/07 20:49:10 Tx PL HouseUnit: C3
50+
12/07 20:49:10 Tx PL House: C Func: Off
51+
12/07 20:49:10 Rx RF HouseUnit: C3 Func: Off
52+
12/07 20:49:10 Tx PL HouseUnit: C3
53+
12/07 20:49:10 Tx PL House: C Func: Off
54+
12/07 20:49:17 Rx RFSEC Addr: 0x11 Func: Lights_Off_SH624
55+
12/07 20:49:17 Rx RFSEC Addr: 0x11 Func: Lights_Off_SH624
56+
12/07 20:49:37 Rx RFSEC Addr: C6:1B:00 Func: Motion_alert_MS10A
57+
12/07 20:49:37 Rx RFSEC Addr: C6:1B:00 Func: Motion_alert_MS10A
58+
12/07 20:49:37 Rx RFSEC Addr: C6:1B:00 Func: Motion_alert_MS10A
59+
12/07 20:49:37 Rx RFSEC Addr: C6:1B:00 Func: Motion_alert_MS10A
5460

5561
Everything sent to netcat standard input is sent to mochad. The following is a
5662
brief list of mochad commands.
@@ -142,6 +148,9 @@ For OpenWrt based systems, using LuCi would make more sense than Perl since
142148
LuCi is already present in the system. However, the Perl CGI scripts work fine
143149
with lighttpd on OpenWrt.
144150

151+
This project in not in any way affliated with X10 Corp. (www.x10.com). Do
152+
not contact them about this driver since they know nothing about it.
153+
145154
== References
146155

147156
The following documents were useful in development of this program.

hotplug2/mochad

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ START=50
44
SSD=start-stop-daemon
55
NAME=mochad
66
PIDF=/var/run/$NAME.pid
7-
PROG=/usr/local/bin/$NAME
7+
PROG=/usr/sbin/$NAME
88

99
start() {
1010
$SSD -S -m -p $PIDF -q -x $PROG &

opkg/Makefile

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
include $(TOPDIR)/rules.mk
2+
3+
PKG_NAME:=mochad
4+
PKG_VERSION:=0.1.2
5+
PKG_RELEASE:=1
6+
7+
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
8+
PKG_SOURCE_URL:=http://sourceforge.net/projects/mochad/files
9+
PKG_MD5SUM:=5d80a6532d6af73f822cc31c322b2b89
10+
11+
PKG_BUILD_DEPENDS:=+libusb-1.0
12+
PKG_BUILD_PARALLEL:=1
13+
14+
include $(INCLUDE_DIR)/package.mk
15+
16+
define Package/mochad
17+
SECTION:=utils
18+
CATEGORY:=Utilities
19+
TITLE:=X10 USB controller driver
20+
URL:=http://sourceforge.net/projects/mochad
21+
DEPENDS:=+libusb-1.0 +usbutils
22+
endef
23+
24+
define Package/mochad/description
25+
X10 USB controller driver X10 CM15A and CM19A USB device driver with
26+
TCP socket gateway.
27+
endef
28+
29+
# uses GNU configure
30+
31+
define Package/mochad/install
32+
$(INSTALL_DIR) $(1)/usr/sbin
33+
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mochad $(1)/usr/sbin/
34+
$(INSTALL_DIR) $(1)/etc/init.d
35+
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hotplug2/mochad $(1)/etc/init.d/
36+
$(INSTALL_DIR) $(1)/etc/hotplug.d/usb
37+
$(INSTALL_DATA) $(PKG_BUILD_DIR)/hotplug2/20-usb-x10 $(1)/etc/hotplug.d/usb
38+
endef
39+
40+
$(eval $(call BuildPackage,mochad))

0 commit comments

Comments
 (0)