Change dir of openwrt and refactor sh script

This commit is contained in:
2021-08-29 19:38:08 +02:00
parent 6179fdee75
commit 81de0845a3
3 changed files with 9 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.bh.ttx.sk/jaro/usbserial-dw.git
PKG_MIRROR_HASH:=
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=
PKG_SOURCE_VERSION:=6179fdee75ee3fcdb766aef5eb791c38e75ee33b
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
@@ -63,7 +63,7 @@ define Package/usbserial-dw/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/usbserial-dw $(1)/usr/bin/usbserial-dw
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/usbserial-dw.config $(1)/etc/config/
$(INSTALL_DATA) ./files/usbserial-dw.config $(1)/etc/config/usbserial
endef
define Package/usbserial-dw/conffiles

View File

@@ -3,5 +3,5 @@ config capture
option speed 115200
option directory /tmp
option file camera.jpg
option webserver http://nuc.bh.ttx.sk/upload/
option url https://meranie.bh.ttx.sk/upload/image
option time 300

View File

@@ -4,7 +4,7 @@
. /lib/functions.sh
PROG=/usr/bin/usbserial-dw
CURL=/usr/bin/curl
parse_capture() {
local section="$1"
@@ -17,9 +17,12 @@ parse_capture() {
config_get _speed "$section" "speed"
config_get _dir "$section" "dir"
config_get _file "$section" "file"
config_get _url "$section" "url"
$PROG --port $_port --speed $_speed --dir $_dir --file $_file
$CURL upload
cd $_dir
$CURL -v -X POST -F "submit=OK" -F "file=@camera.jpg" $_url
rm $_file
}
config_load usbserial