summaryrefslogtreecommitdiff
path: root/bigclown-gateway/files
diff options
context:
space:
mode:
Diffstat (limited to 'bigclown-gateway/files')
-rwxr-xr-xbigclown-gateway/files/bcg9
-rw-r--r--bigclown-gateway/files/config (renamed from bigclown-gateway/files/bc-gateway-usb-dongle.config)0
-rwxr-xr-xbigclown-gateway/files/init (renamed from bigclown-gateway/files/bc-gateway-usb-dongle.init)16
-rw-r--r--bigclown-gateway/files/udev1
4 files changed, 17 insertions, 9 deletions
diff --git a/bigclown-gateway/files/bcg b/bigclown-gateway/files/bcg
new file mode 100755
index 0000000..fe261f4
--- /dev/null
+++ b/bigclown-gateway/files/bcg
@@ -0,0 +1,9 @@
+#!/usr/bin/python3.6
+import bcg
+import sys
+from pkg_resources import load_entry_point
+
+if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('bcg', 'console_scripts', 'bcg')()
+ )
diff --git a/bigclown-gateway/files/bc-gateway-usb-dongle.config b/bigclown-gateway/files/config
index 7fa3977..7fa3977 100644
--- a/bigclown-gateway/files/bc-gateway-usb-dongle.config
+++ b/bigclown-gateway/files/config
diff --git a/bigclown-gateway/files/bc-gateway-usb-dongle.init b/bigclown-gateway/files/init
index bae6d11..090cc06 100755
--- a/bigclown-gateway/files/bc-gateway-usb-dongle.init
+++ b/bigclown-gateway/files/init
@@ -1,16 +1,12 @@
#!/bin/sh /etc/rc.common
-START=99
+START=98
STOP=1
USE_PROCD=1
PROG=/usr/bin/bcg
-
-CONF=/tmp/bc-gateway-usb-dongle.generated.conf
-
-UCI_STARTED=
-UCI_DISABLED=
+CONF=/tmp/etc/bigclown-gateway.conf
append() {
local cfg="$1"
@@ -24,18 +20,18 @@ append() {
}
start_service() {
- config_load bc-gateway-usb-dongle
+ config_load bigclown-gateway
rm -rf $CONF
- echo "Generating bc-gateway-usb-dongle config file in $CONF"
+ echo "Generating bigclown-gateway config file in $CONF"
append gateway name 'name:' usb-dongle
+ # TODO add udev rules and use different default here
append gateway device 'device:' /dev/ttyUSB0
append gateway automatic_rename_kit_nodes 'automatic_rename_kit_nodes:' 1
append gateway base_topic_prefix 'base_topic_prefix:'
echo "mqtt:" >> $CONF
-
append mqtt host ' host:' localhost
append mqtt port ' port:' 1883
append mqtt cafile ' cafile:'
@@ -45,6 +41,8 @@ start_service() {
procd_open_instance
procd_set_param respawn
procd_set_param command "$PROG" -c "$CONF" -W
+ procd_set_param stdout 1
+ procd_set_param stderr 1
procd_close_instance
}
diff --git a/bigclown-gateway/files/udev b/bigclown-gateway/files/udev
new file mode 100644
index 0000000..d7a854b
--- /dev/null
+++ b/bigclown-gateway/files/udev
@@ -0,0 +1 @@
+SUBSYSTEMS=="usb", ACTION=="add", KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", ATTRS{serial}=="bc-usb-dongle*", SYMLINK+="bcUD%n", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/dev/bcUD%n"