From 9f0bab377660d3855af785c5ddbc19f69818468e Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Wed, 5 Mar 2014 02:35:28 +0100 Subject: [PATCH 01/16] fix poll --- culfw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/culfw.c b/culfw.c index 1904bb7..72c5c6a 100644 --- a/culfw.c +++ b/culfw.c @@ -167,7 +167,8 @@ int culfw_poll(struct culfw_dev *dev, int timeout) dev->cb(buf, r, dev->cb_data); - return pfds[0].fd; + errno = 0; + return -1; } void culfw_close(struct culfw_dev *dev) -- 2.39.5 From cda220240e89e21e8b7dd76ab6b6a56000ce20e6 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Wed, 5 Mar 2014 08:26:09 +0100 Subject: [PATCH 02/16] increase hm-buffer for culfw-devices --- flash-ota.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flash-ota.c b/flash-ota.c index 9126768..7afab13 100644 --- a/flash-ota.c +++ b/flash-ota.c @@ -207,7 +207,7 @@ int send_hm_message(struct ota_dev *dev, struct recv_data *rdata, uint8_t *msg) break; case DEVICE_TYPE_CULFW: { - char buf[128]; + char buf[256]; int i; memset(buf, 0, sizeof(buf)); -- 2.39.5 From 0edcd7f291b728aee5e0c99434d2d8d9d81f6af6 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Wed, 5 Mar 2014 08:56:19 +0100 Subject: [PATCH 03/16] fix variable assignment, copyright year --- culfw.c | 2 +- culfw.h | 2 +- flash-ota.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/culfw.c b/culfw.c index 72c5c6a..0dfb807 100644 --- a/culfw.c +++ b/culfw.c @@ -1,6 +1,6 @@ /* culfw driver * - * Copyright (c) 2013 Michael Gernoth + * Copyright (c) 2014 Michael Gernoth * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/culfw.h b/culfw.h index 8f64433..29aacaf 100644 --- a/culfw.h +++ b/culfw.h @@ -1,6 +1,6 @@ /* culfw driver * - * Copyright (c) 2013 Michael Gernoth + * Copyright (c) 2014 Michael Gernoth * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to diff --git a/flash-ota.c b/flash-ota.c index 7afab13..fdd5936 100644 --- a/flash-ota.c +++ b/flash-ota.c @@ -450,8 +450,8 @@ int main(int argc, char **argv) printf("Waiting for device with serial %s\n", serial); while (1) { + errno = 0; switch (dev.type) { - errno = 0; case DEVICE_TYPE_CULFW: pfd = culfw_poll(dev.culfw, 1); break; -- 2.39.5 From a65c08fc834ac57cb4aab5470ca144d13076a2bd Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Wed, 5 Mar 2014 11:41:00 +0100 Subject: [PATCH 04/16] add culfw firmware version-check --- culfw.c | 31 ++++++++++++++++ culfw.h | 1 + flash-ota.c | 105 +++++++++++++++++++++++++++++++++++++++++----------- 3 files changed, 116 insertions(+), 21 deletions(-) diff --git a/culfw.c b/culfw.c index 0dfb807..a4c949b 100644 --- a/culfw.c +++ b/culfw.c @@ -175,3 +175,34 @@ void culfw_close(struct culfw_dev *dev) { close(dev->fd); } + +void culfw_flush(struct culfw_dev *dev) +{ + struct pollfd pfds[1]; + int ret; + int r = 0; + uint8_t buf[1024]; + + tcflush(dev->fd, TCIOFLUSH); + + while(1) { + memset(pfds, 0, sizeof(struct pollfd) * 1); + + pfds[0].fd = dev->fd; + pfds[0].events = POLLIN; + + ret = poll(pfds, 1, 100); + if (ret <= 0) + break; + + if (!(pfds[0].revents & POLLIN)) + break; + + memset(buf, 0, sizeof(buf)); + r = read(dev->fd, buf, sizeof(buf)); + if (r <= 0) + break; + } + + return; +} diff --git a/culfw.h b/culfw.h index 29aacaf..6f310fc 100644 --- a/culfw.h +++ b/culfw.h @@ -35,3 +35,4 @@ struct culfw_dev *culfw_init(char *device, uint32_t speed, culfw_cb_fn cb, void int culfw_send(struct culfw_dev *dev, char *cmd, int cmdlen); int culfw_poll(struct culfw_dev *dev, int timeout); void culfw_close(struct culfw_dev *dev); +void culfw_flush(struct culfw_dev *dev); diff --git a/flash-ota.c b/flash-ota.c index fdd5936..31e2ab5 100644 --- a/flash-ota.c +++ b/flash-ota.c @@ -71,7 +71,7 @@ struct recv_data { enum message_type message_type; uint16_t status; int speed; - uint16_t hmcfgusb_version; + uint16_t version; }; static int parse_hmcfgusb(uint8_t *buf, int buf_len, void *data) @@ -102,7 +102,7 @@ static int parse_hmcfgusb(uint8_t *buf, int buf_len, void *data) rdata->speed = buf[1]; break; case 'H': - rdata->hmcfgusb_version = (buf[11] << 8) | buf[12]; + rdata->version = (buf[11] << 8) | buf[12]; my_hmid = (buf[0x1b] << 16) | (buf[0x1c] << 8) | buf[0x1d]; break; default: @@ -125,25 +125,57 @@ static int parse_culfw(uint8_t *buf, int buf_len, void *data) if (buf_len <= 3) return 0; - if (buf[0] != 'A') - return 0; + switch(buf[0]) { + case 'A': + if (buf[1] == 's') + return 0; + + while(validate_nibble(buf[(pos * 2) + 1]) && + validate_nibble(buf[(pos * 2) + 2]) && + (pos + 1 < buf_len)) { + rdata->message[pos] = ascii_to_nibble(buf[(pos * 2) + 1]) << 4; + rdata->message[pos] |= ascii_to_nibble(buf[(pos * 2) + 2]); + pos++; + } - if (buf[1] == 's') - return 0; + if (hmid && (SRC(rdata->message) != hmid)) + return 0; - while(validate_nibble(buf[(pos * 2) + 1]) && - validate_nibble(buf[(pos * 2) + 2]) && - (pos + 1 < buf_len)) { - rdata->message[pos] = ascii_to_nibble(buf[(pos * 2) + 1]) << 4; - rdata->message[pos] |= ascii_to_nibble(buf[(pos * 2) + 2]); - pos++; + rdata->message_type = MESSAGE_TYPE_E; + break; + case 'V': + { + uint8_t v; + char *s; + char *e; + + s = ((char*)buf) + 2; + e = strchr(s, '.'); + if (!e) { + fprintf(stderr, "Unknown response from CUL: %s", buf); + return 0; + } + *e = '\0'; + v = atoi(s); + rdata->version = v << 8; + + s = e + 1; + e = strchr(s, ' '); + if (!e) { + fprintf(stderr, "Unknown response from CUL: %s", buf); + return 0; + } + *e = '\0'; + v = atoi(s); + rdata->version |= v; + } + break; + default: + fprintf(stderr, "Unknown response from CUL: %s", buf); + return 0; + break; } - if (hmid && (SRC(rdata->message) != hmid)) - return 0; - - rdata->message_type = MESSAGE_TYPE_E; - return 1; } @@ -372,12 +404,43 @@ int main(int argc, char **argv) memset(&dev, 0, sizeof(struct ota_dev)); if (culfw_dev) { + printf("Opening culfw-device at path %s with speed %u\n", culfw_dev, bps); dev.culfw = culfw_init(culfw_dev, bps, parse_culfw, &rdata); if (!dev.culfw) { fprintf(stderr, "Can't initialize CUL at %s with rate %u\n", culfw_dev, bps); exit(EXIT_FAILURE); } dev.type = DEVICE_TYPE_CULFW; + + printf("Requesting firmware-version\n"); + culfw_send(dev.culfw, "\r\n", 2); + culfw_flush(dev.culfw); + + while (1) { + culfw_send(dev.culfw, "V\r\n", 3); + + errno = 0; + pfd = culfw_poll(dev.culfw, 1); + if ((pfd < 0) && errno) { + if (errno != ETIMEDOUT) { + perror("\n\nhmcfgusb_poll"); + exit(EXIT_FAILURE); + } + } + if (rdata.version) + break; + } + + printf("culfw-device firmware version: %u.%02u\n", + (rdata.version >> 8) & 0xff, + rdata.version & 0xff); + + if (rdata.version < 0x0139) { + fprintf(stderr, "\nThis version does _not_ support firmware upgrade mode!\n"); + exit(EXIT_FAILURE); + } else if (rdata.version < 0x0140) { + printf("\n*** This version probably not supports firmware upgrade mode! ***\n\n"); + } } else { hmcfgusb_set_debug(debug); @@ -430,16 +493,16 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } } - if (rdata.hmcfgusb_version) + if (rdata.version) break; } - if (rdata.hmcfgusb_version < 0x3c7) { - fprintf(stderr, "HM-CFG-USB firmware too low: %u < 967\n", rdata.hmcfgusb_version); + if (rdata.version < 0x3c7) { + fprintf(stderr, "HM-CFG-USB firmware too low: %u < 967\n", rdata.version); exit(EXIT_FAILURE); } - printf("HM-CFG-USB firmware version: %u\n", rdata.hmcfgusb_version); + printf("HM-CFG-USB firmware version: %u\n", rdata.version); } if (!switch_speed(&dev, &rdata, 10)) { -- 2.39.5 From 3b35a8c145cb567b625d32030ba3a287b478dd43 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Thu, 6 Mar 2014 22:37:49 +0100 Subject: [PATCH 05/16] increase timeout granularity to handle missing acks on culfw-devices --- culfw.c | 2 +- flash-hmcfgusb.c | 2 +- flash-ota.c | 18 +++++++++--------- hmcfgusb.c | 8 +++----- hmland.c | 2 +- hmsniff.c | 2 +- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/culfw.c b/culfw.c index a4c949b..6cfa975 100644 --- a/culfw.c +++ b/culfw.c @@ -141,7 +141,7 @@ int culfw_poll(struct culfw_dev *dev, int timeout) pfds[0].fd = dev->fd; pfds[0].events = POLLIN; - ret = poll(pfds, 1, timeout * 1000); + ret = poll(pfds, 1, timeout); if (ret == -1) return -1; diff --git a/flash-hmcfgusb.c b/flash-hmcfgusb.c index 45d467f..0f0b9ce 100644 --- a/flash-hmcfgusb.c +++ b/flash-hmcfgusb.c @@ -134,7 +134,7 @@ int main(int argc, char **argv) printf("Waiting for ack...\n"); do { errno = 0; - pfd = hmcfgusb_poll(dev, 1); + pfd = hmcfgusb_poll(dev, 1000); if ((pfd < 0) && errno) { if (errno != ETIMEDOUT) { perror("\n\nhmcfgusb_poll"); diff --git a/flash-ota.c b/flash-ota.c index 31e2ab5..634e19b 100644 --- a/flash-ota.c +++ b/flash-ota.c @@ -228,7 +228,7 @@ int send_hm_message(struct ota_dev *dev, struct recv_data *rdata, uint8_t *msg) } } errno = 0; - pfd = hmcfgusb_poll(dev->hmcfgusb, 1); + pfd = hmcfgusb_poll(dev->hmcfgusb, 1000); if ((pfd < 0) && errno) { if (errno != ETIMEDOUT) { perror("\n\nhmcfgusb_poll"); @@ -263,7 +263,7 @@ int send_hm_message(struct ota_dev *dev, struct recv_data *rdata, uint8_t *msg) int pfd; do { errno = 0; - pfd = culfw_poll(dev->culfw, 1); + pfd = culfw_poll(dev->culfw, 200); if ((pfd < 0) && errno) { if (errno != ETIMEDOUT) { perror("\n\nculfw_poll"); @@ -305,7 +305,7 @@ static int switch_speed(struct ota_dev *dev, struct recv_data *rdata, uint8_t sp while (1) { errno = 0; - pfd = hmcfgusb_poll(dev->hmcfgusb, 1); + pfd = hmcfgusb_poll(dev->hmcfgusb, 1000); if ((pfd < 0) && errno) { if (errno != ETIMEDOUT) { perror("\n\nhmcfgusb_poll"); @@ -420,7 +420,7 @@ int main(int argc, char **argv) culfw_send(dev.culfw, "V\r\n", 3); errno = 0; - pfd = culfw_poll(dev.culfw, 1); + pfd = culfw_poll(dev.culfw, 1000); if ((pfd < 0) && errno) { if (errno != ETIMEDOUT) { perror("\n\nhmcfgusb_poll"); @@ -486,7 +486,7 @@ int main(int argc, char **argv) while (1) { errno = 0; - pfd = hmcfgusb_poll(dev.hmcfgusb, 1); + pfd = hmcfgusb_poll(dev.hmcfgusb, 1000); if ((pfd < 0) && errno) { if (errno != ETIMEDOUT) { perror("\n\nhmcfgusb_poll"); @@ -516,11 +516,11 @@ int main(int argc, char **argv) errno = 0; switch (dev.type) { case DEVICE_TYPE_CULFW: - pfd = culfw_poll(dev.culfw, 1); + pfd = culfw_poll(dev.culfw, 1000); break; case DEVICE_TYPE_HMCFGUSB: default: - pfd = hmcfgusb_poll(dev.hmcfgusb, 1); + pfd = hmcfgusb_poll(dev.hmcfgusb, 1000); break; } @@ -713,11 +713,11 @@ int main(int argc, char **argv) errno = 0; switch(dev.type) { case DEVICE_TYPE_CULFW: - pfd = culfw_poll(dev.culfw, 1); + pfd = culfw_poll(dev.culfw, 1000); break; case DEVICE_TYPE_HMCFGUSB: default: - pfd = hmcfgusb_poll(dev.hmcfgusb, 1); + pfd = hmcfgusb_poll(dev.hmcfgusb, 1000); break; } if ((pfd < 0) && errno) { diff --git a/hmcfgusb.c b/hmcfgusb.c index c90410a..0e11866 100644 --- a/hmcfgusb.c +++ b/hmcfgusb.c @@ -433,13 +433,11 @@ int hmcfgusb_poll(struct hmcfgusb_dev *dev, int timeout) return -1; } else if (err == 0) { /* No pending timeout or a sane platform */ - tv.tv_sec = timeout; } else { if ((tv.tv_sec == 0) && (tv.tv_usec == 0)) { usb_event = 1; - } else if (tv.tv_sec > timeout) { - tv.tv_sec = timeout; - tv.tv_usec = 0; + } else if ((tv.tv_sec * 1000) < timeout) { + timeout = tv.tv_sec * 1000; } } @@ -448,7 +446,7 @@ int hmcfgusb_poll(struct hmcfgusb_dev *dev, int timeout) dev->pfd[i].revents = 0; } - n = poll(dev->pfd, dev->n_pfd, tv.tv_sec * 1000); + n = poll(dev->pfd, dev->n_pfd, timeout); if (n < 0) { perror("poll"); errno = 0; diff --git a/hmland.c b/hmland.c index fd2d09e..38cd7a3 100644 --- a/hmland.c +++ b/hmland.c @@ -508,7 +508,7 @@ static int comm(int fd_in, int fd_out, int master_socket, int flags) while(!quit) { int fd; - fd = hmcfgusb_poll(dev, 1); /* Wakeup device/bus at least once a second */ + fd = hmcfgusb_poll(dev, 1000); /* Wakeup device/bus at least once a second */ if (fd >= 0) { if (fd == master_socket) { int client; diff --git a/hmsniff.c b/hmsniff.c index 39133d3..a3cbe7a 100644 --- a/hmsniff.c +++ b/hmsniff.c @@ -201,7 +201,7 @@ int main(int argc, char **argv) rdata.wrong_hmid = 0; hmcfgusb_send(dev, (unsigned char*)"K", 1, 1); } - fd = hmcfgusb_poll(dev, 1); + fd = hmcfgusb_poll(dev, 1000); if (fd >= 0) { fprintf(stderr, "activity on unknown fd %d!\n", fd); continue; -- 2.39.5 From 57b387cefd9d05e3c44db6386b171f84b2dc66bb Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Fri, 14 Mar 2014 20:55:37 +0100 Subject: [PATCH 06/16] fix culfw version-check --- flash-ota.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/flash-ota.c b/flash-ota.c index 634e19b..5efd027 100644 --- a/flash-ota.c +++ b/flash-ota.c @@ -435,11 +435,9 @@ int main(int argc, char **argv) (rdata.version >> 8) & 0xff, rdata.version & 0xff); - if (rdata.version < 0x0139) { - fprintf(stderr, "\nThis version does _not_ support firmware upgrade mode!\n"); + if (rdata.version < 0x013a) { + fprintf(stderr, "\nThis version does _not_ support firmware upgrade mode, you need at least 1.58!\n"); exit(EXIT_FAILURE); - } else if (rdata.version < 0x0140) { - printf("\n*** This version probably not supports firmware upgrade mode! ***\n\n"); } } else { hmcfgusb_set_debug(debug); -- 2.39.5 From 6703483b89043091ff28ca2c1ebfd93aedc3d3db Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Sun, 16 Mar 2014 17:57:26 +0100 Subject: [PATCH 07/16] bump version to 0.096-git --- version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.h b/version.h index 417afbb..cccf8c8 100644 --- a/version.h +++ b/version.h @@ -1 +1 @@ -#define VERSION "0.095-git" +#define VERSION "0.096-git" -- 2.39.5 From c8cafbead818c84304552d269535e7342852522d Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Wed, 14 May 2014 10:08:36 +0200 Subject: [PATCH 08/16] only reboot by default when firmware-version is < 0.967 --- hmland.c | 25 ++++++++++++++++++++++--- version.h | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/hmland.c b/hmland.c index 38cd7a3..6dc2cac 100644 --- a/hmland.c +++ b/hmland.c @@ -55,6 +55,7 @@ static int verbose = 0; static int reboot_seconds = 0; static int reboot_at_hour = -1; static int reboot_at_minute = -1; +static int reboot_set = 0; struct queued_rx { char *rx; @@ -211,6 +212,7 @@ static int hmlan_format_out(uint8_t *buf, int buf_len, void *data) uint8_t out[1024]; uint8_t *outpos; uint8_t *inpos; + uint16_t version; int fd = *((int*)data); int w; @@ -230,6 +232,8 @@ static int hmlan_format_out(uint8_t *buf, int buf_len, void *data) buf[7] = 'N'; } format_part_out(&inpos, (buf_len-(inpos-buf)), &outpos, (sizeof(out)-(outpos-out)), 0, FLAG_LENGTH_BYTE); + version = inpos[0] << 8; + version |= inpos[1]; format_part_out(&inpos, (buf_len-(inpos-buf)), &outpos, (sizeof(out)-(outpos-out)), 2, FLAG_FORMAT_HEX | FLAG_COMMA_BEFORE); format_part_out(&inpos, (buf_len-(inpos-buf)), &outpos, (sizeof(out)-(outpos-out)), 0, FLAG_COMMA_BEFORE | FLAG_LENGTH_BYTE); format_part_out(&inpos, (buf_len-(inpos-buf)), &outpos, (sizeof(out)-(outpos-out)), 3, FLAG_FORMAT_HEX | FLAG_COMMA_BEFORE); @@ -237,6 +241,22 @@ static int hmlan_format_out(uint8_t *buf, int buf_len, void *data) format_part_out(&inpos, (buf_len-(inpos-buf)), &outpos, (sizeof(out)-(outpos-out)), 4, FLAG_FORMAT_HEX | FLAG_COMMA_BEFORE); format_part_out(&inpos, (buf_len-(inpos-buf)), &outpos, (sizeof(out)-(outpos-out)), 2, FLAG_FORMAT_HEX | FLAG_COMMA_BEFORE | FLAG_NL); + if (!reboot_set) { + int new_reboot_seconds; + + if (version < 0x03c7) { + new_reboot_seconds = DEFAULT_REBOOT_SECONDS; + } else { + new_reboot_seconds = 0; + } + + if (verbose && new_reboot_seconds && (reboot_seconds != new_reboot_seconds)) + printf("Rebooting in %u seconds due to old firmware (0.%d)\n", + new_reboot_seconds, version); + + reboot_seconds = new_reboot_seconds; + } + break; case 'E': format_part_out(&inpos, (buf_len-(inpos-buf)), &outpos, (sizeof(out)-(outpos-out)), 3, FLAG_FORMAT_HEX); @@ -744,7 +764,7 @@ void hmlan_syntax(char *prog) fprintf(stderr, "\t-l ip\t\tlisten on given IP address only (for example 127.0.0.1)\n"); fprintf(stderr, "\t-P\t\tcreate PID file " PID_FILE " in daemon mode\n"); fprintf(stderr, "\t-p n\t\tlisten on port n (default: 1000)\n"); - fprintf(stderr, "\t-r n\t\treboot HM-CFG-USB after n seconds (0: no reboot, default: %u)\n", DEFAULT_REBOOT_SECONDS); + fprintf(stderr, "\t-r n\t\treboot HM-CFG-USB after n seconds (0: no reboot, default: %u if FW < 0.967, 0 otherwise)\n", DEFAULT_REBOOT_SECONDS); fprintf(stderr, "\t hh:mm\treboot HM-CFG-USB daily at hh:mm\n"); fprintf(stderr, "\t-v\t\tverbose mode\n"); fprintf(stderr, "\t-V\t\tshow version (" VERSION ")\n"); @@ -760,8 +780,6 @@ int main(int argc, char **argv) char *ep; int opt; - reboot_seconds = DEFAULT_REBOOT_SECONDS; - while((opt = getopt(argc, argv, "DdhiPp:Rr:l:vV")) != -1) { switch (opt) { case 'D': @@ -805,6 +823,7 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } } + reboot_set = 1; break; case 'l': iface = optarg; diff --git a/version.h b/version.h index cccf8c8..0680b90 100644 --- a/version.h +++ b/version.h @@ -1 +1 @@ -#define VERSION "0.096-git" +#define VERSION "0.097-git" -- 2.39.5 From 18e63b25f26a448e310adfca9fea89e4212a2cf4 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Thu, 29 May 2014 18:19:42 +0200 Subject: [PATCH 09/16] add possibility to log network communication --- hmland.c | 108 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 42 deletions(-) diff --git a/hmland.c b/hmland.c index 6dc2cac..6b89ece 100644 --- a/hmland.c +++ b/hmland.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,7 @@ extern char *optarg; static int impersonate_hmlanif = 0; static int debug = 0; static int verbose = 0; +static FILE *logfile = NULL; static int reboot_seconds = 0; static int reboot_at_hour = -1; static int reboot_at_minute = -1; @@ -89,6 +91,48 @@ static void print_timestamp(FILE *f) fprintf(f, "%s.%06ld: ", ts, tv.tv_usec); } +static void write_log(char *buf, int len, char *fmt, ...) +{ + va_list ap; + int i; + + if ((!logfile) && (!verbose)) + return; + + if (logfile) + print_timestamp(logfile); + if (verbose) + print_timestamp(stdout); + + if (fmt) { + if (logfile) { + va_start(ap, fmt); + vfprintf(logfile, fmt, ap); + va_end(ap); + } + if (verbose) { + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } + } + + if (buf && len) { + for (i = 0; i < len; i++) { + if (logfile) + fprintf(logfile, "%c", buf[i]); + if (verbose) + printf("%c", buf[i]); + } + if (logfile) + fprintf(logfile, "\n"); + if (verbose) + printf("\n"); + } + if (logfile) + fflush(logfile); +} + static int format_part_out(uint8_t **inpos, int inlen, uint8_t **outpos, int outlen, int len, int flags) { const uint8_t nibble[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', @@ -319,15 +363,7 @@ static int hmlan_format_out(uint8_t *buf, int buf_len, void *data) return 1; } - if (verbose) { - int i; - - print_timestamp(stdout); - printf("LAN < "); - for (i = 0; i < outpos-out-2; i++) - printf("%c", out[i]); - printf("\n"); - } + write_log((char*)out, outpos-out-2, "LAN < "); w = write(fd, out, outpos-out); if (w <= 0) { @@ -341,15 +377,7 @@ static int hmlan_format_out(uint8_t *buf, int buf_len, void *data) struct queued_rx *last_rx; while (curr_rx) { - if (verbose) { - int i; - - print_timestamp(stdout); - printf("LAN < "); - for (i = 0; i < curr_rx->len-2; i++) - printf("%c", curr_rx->rx[i]); - printf("\n"); - } + write_log(curr_rx->rx, curr_rx->len-2, "LAN < "); w = write(fd, curr_rx->rx, curr_rx->len); if (w <= 0) { @@ -411,13 +439,7 @@ static int hmlan_parse_in(int fd, void *data) if (last == 0) continue; - if (verbose) { - print_timestamp(stdout); - printf("LAN > "); - for (i = 0; i < last; i++) - printf("%c", instart[i]); - printf("\n"); - } + write_log((char*)instart, last, "LAN > "); memset(out, 0, sizeof(out)); *outpos++ = *inpos++; @@ -717,28 +739,22 @@ static int socket_server(char *iface, int port, int flags) /* FIXME: getnameinfo... */ client_addr = ntohl(csin.sin_addr.s_addr); - if (verbose) { - print_timestamp(stdout); - printf("Client %d.%d.%d.%d connected!\n", - (client_addr & 0xff000000) >> 24, - (client_addr & 0x00ff0000) >> 16, - (client_addr & 0x0000ff00) >> 8, - (client_addr & 0x000000ff)); - } + write_log(NULL, 0, "Client %d.%d.%d.%d connected!\n", + (client_addr & 0xff000000) >> 24, + (client_addr & 0x00ff0000) >> 16, + (client_addr & 0x0000ff00) >> 8, + (client_addr & 0x000000ff)); comm(client, client, sock, flags); shutdown(client, SHUT_RDWR); close(client); - if (verbose) { - print_timestamp(stdout); - printf("Connection to %d.%d.%d.%d closed!\n", - (client_addr & 0xff000000) >> 24, - (client_addr & 0x00ff0000) >> 16, - (client_addr & 0x0000ff00) >> 8, - (client_addr & 0x000000ff)); - } + write_log(NULL, 0, "Connection to %d.%d.%d.%d closed!\n", + (client_addr & 0xff000000) >> 24, + (client_addr & 0x00ff0000) >> 16, + (client_addr & 0x0000ff00) >> 8, + (client_addr & 0x000000ff)); sleep(1); } @@ -762,6 +778,7 @@ void hmlan_syntax(char *prog) fprintf(stderr, "\t-h\t\tthis help\n"); fprintf(stderr, "\t-i\t\tinteractive mode (connect HM-CFG-USB to terminal)\n"); fprintf(stderr, "\t-l ip\t\tlisten on given IP address only (for example 127.0.0.1)\n"); + fprintf(stderr, "\t-L logfile\tlog network-communication to logfile\n"); fprintf(stderr, "\t-P\t\tcreate PID file " PID_FILE " in daemon mode\n"); fprintf(stderr, "\t-p n\t\tlisten on port n (default: 1000)\n"); fprintf(stderr, "\t-r n\t\treboot HM-CFG-USB after n seconds (0: no reboot, default: %u if FW < 0.967, 0 otherwise)\n", DEFAULT_REBOOT_SECONDS); @@ -780,7 +797,7 @@ int main(int argc, char **argv) char *ep; int opt; - while((opt = getopt(argc, argv, "DdhiPp:Rr:l:vV")) != -1) { + while((opt = getopt(argc, argv, "DdhiPp:Rr:l:L:vV")) != -1) { switch (opt) { case 'D': debug = 1; @@ -828,6 +845,13 @@ int main(int argc, char **argv) case 'l': iface = optarg; break; + case 'L': + logfile = fopen(optarg, "a"); + if (!logfile) { + perror("fopen(logfile)"); + exit(EXIT_FAILURE); + } + break; case 'v': verbose = 1; break; -- 2.39.5 From 57a64032bff6a5a6200dd8df97174a3691ed0d11 Mon Sep 17 00:00:00 2001 From: JSurf Date: Thu, 19 Jun 2014 09:22:02 +0200 Subject: [PATCH 10/16] Create README.md --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1f7fc18 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +hmcfgusb +======== + +github mirror of http://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb + +I am not the author of this package, i'm just mirroring it here on github, all credits go to +Michael Gernoth http://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb + +-------------------------------------------------------------------------------------- + +This repository contains utilities to use the HM-CFG-USB(2) (HomeMatic USB Konfigurations-Adapter) from ELV on Linux/Unix by using libusb 1.0. +The HM-CFG-USB can be used to send and receive BidCoS-Packets to control HomeMatic home automation devices (like remote controllable sockets, switches, sensors, ...). + +This repository contains, amongst others, an application, which emulates the HomeMatic LAN configuration adapter-protocol to make it possible to use the HM-CFG-USB in Fhem or as a lan configuration tool for the CCU or the HomeMatic windows configuration software. + +Short hmland HowTo: +Install prerequisites: apt-get install libusb-1.0-0-dev make gcc +Get the current version of this software: hmcfgusb-HEAD-xxxxxxx.tar.gz (xxxxxxx is part of the commit-id. xxxxxxx is just a placeholder for this HowTo, use your value) +Extract the archive: tar xzf hmcfgusb-HEAD-xxxxxxx.tar.gz +Change into the new directory: cd hmcfgusb-HEAD-xxxxxxx +Build the code: make +Optional: Install udev-rules so normal users can access the device: sudo cp hmcfgusb.rules /etc/udev/rules.d/ +Plug in the HM-CFG-USB +Run hmland (with debugging the first time, see -h switch): ./hmland -p 1234 -D +Configure Fhem to use your new HMLAN device: +define hmusb HMLAN 127.0.0.1:1234 +attr hmusb hmId +Updating the HM-CFG-USB firmware to version 0.967: +Compile the hmcfgusb utilities like in the hmland HowTo above (steps 1 to 7) and stay in the directory +Download the new firmware: hmusbif.03c7.enc: wget https://git.zerfleddert.de/hmcfgusb/firmware/hmusbif.03c7.enc +Make sure that hmland is not running +Flash the update to the USB-stick: ./flash-hmcfgusb hmusbif.03c7.enc (You might need to use sudo for this) +(Old) Prebuilt package for OpenWRT (ar71xx): hmcfgusb_1_ar71xx.ipk -- 2.39.5 From 4d15b8cac3fe7a4ec183ff840f457baadbd065a7 Mon Sep 17 00:00:00 2001 From: JSurf Date: Thu, 19 Jun 2014 09:24:06 +0200 Subject: [PATCH 11/16] Update README.md --- README.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 1f7fc18..907d06b 100644 --- a/README.md +++ b/README.md @@ -8,26 +8,26 @@ Michael Gernoth http://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb -------------------------------------------------------------------------------------- -This repository contains utilities to use the HM-CFG-USB(2) (HomeMatic USB Konfigurations-Adapter) from ELV on Linux/Unix by using libusb 1.0. -The HM-CFG-USB can be used to send and receive BidCoS-Packets to control HomeMatic home automation devices (like remote controllable sockets, switches, sensors, ...). + This repository contains utilities to use the HM-CFG-USB(2) (HomeMatic USB Konfigurations-Adapter) from ELV on Linux/Unix by using libusb 1.0. + The HM-CFG-USB can be used to send and receive BidCoS-Packets to control HomeMatic home automation devices (like remote controllable sockets, switches, sensors, ...). -This repository contains, amongst others, an application, which emulates the HomeMatic LAN configuration adapter-protocol to make it possible to use the HM-CFG-USB in Fhem or as a lan configuration tool for the CCU or the HomeMatic windows configuration software. + This repository contains, amongst others, an application, which emulates the HomeMatic LAN configuration adapter-protocol to make it possible to use the HM-CFG-USB in Fhem or as a lan configuration tool for the CCU or the HomeMatic windows configuration software. -Short hmland HowTo: -Install prerequisites: apt-get install libusb-1.0-0-dev make gcc -Get the current version of this software: hmcfgusb-HEAD-xxxxxxx.tar.gz (xxxxxxx is part of the commit-id. xxxxxxx is just a placeholder for this HowTo, use your value) -Extract the archive: tar xzf hmcfgusb-HEAD-xxxxxxx.tar.gz -Change into the new directory: cd hmcfgusb-HEAD-xxxxxxx -Build the code: make -Optional: Install udev-rules so normal users can access the device: sudo cp hmcfgusb.rules /etc/udev/rules.d/ -Plug in the HM-CFG-USB -Run hmland (with debugging the first time, see -h switch): ./hmland -p 1234 -D -Configure Fhem to use your new HMLAN device: -define hmusb HMLAN 127.0.0.1:1234 -attr hmusb hmId -Updating the HM-CFG-USB firmware to version 0.967: -Compile the hmcfgusb utilities like in the hmland HowTo above (steps 1 to 7) and stay in the directory -Download the new firmware: hmusbif.03c7.enc: wget https://git.zerfleddert.de/hmcfgusb/firmware/hmusbif.03c7.enc -Make sure that hmland is not running -Flash the update to the USB-stick: ./flash-hmcfgusb hmusbif.03c7.enc (You might need to use sudo for this) -(Old) Prebuilt package for OpenWRT (ar71xx): hmcfgusb_1_ar71xx.ipk + Short hmland HowTo: + Install prerequisites: apt-get install libusb-1.0-0-dev make gcc + Get the current version of this software: hmcfgusb-HEAD-xxxxxxx.tar.gz (xxxxxxx is part of the commit-id. xxxxxxx is just a placeholder for this HowTo, use your value) + Extract the archive: tar xzf hmcfgusb-HEAD-xxxxxxx.tar.gz + Change into the new directory: cd hmcfgusb-HEAD-xxxxxxx + Build the code: make + Optional: Install udev-rules so normal users can access the device: sudo cp hmcfgusb.rules /etc/udev/rules.d/ + Plug in the HM-CFG-USB + Run hmland (with debugging the first time, see -h switch): ./hmland -p 1234 -D + Configure Fhem to use your new HMLAN device: + define hmusb HMLAN 127.0.0.1:1234 + attr hmusb hmId + Updating the HM-CFG-USB firmware to version 0.967: + Compile the hmcfgusb utilities like in the hmland HowTo above (steps 1 to 7) and stay in the directory + Download the new firmware: hmusbif.03c7.enc: wget https://git.zerfleddert.de/hmcfgusb/firmware/hmusbif.03c7.enc + Make sure that hmland is not running + Flash the update to the USB-stick: ./flash-hmcfgusb hmusbif.03c7.enc (You might need to use sudo for this) + (Old) Prebuilt package for OpenWRT (ar71xx): hmcfgusb_1_ar71xx.ipk -- 2.39.5 From b5850466f0afcc1ed8af7c920d8c02b24e02c404 Mon Sep 17 00:00:00 2001 From: JSurf Date: Thu, 19 Jun 2014 13:53:34 +0200 Subject: [PATCH 12/16] Starting to add debian build stuff --- debian/README.Debian | 6 + debian/README.source | 9 ++ debian/changelog | 5 + debian/compat | 1 + debian/control | 15 ++ debian/copyright | 36 +++++ debian/docs | 1 + debian/emacsen-install.ex | 45 ++++++ debian/emacsen-remove.ex | 15 ++ debian/emacsen-startup.ex | 25 ++++ debian/hmcfgusb.cron.d.ex | 4 + debian/hmcfgusb.default.ex | 10 ++ debian/hmcfgusb.doc-base.EX | 20 +++ debian/init.d.ex | 154 +++++++++++++++++++ debian/manpage.1.ex | 59 ++++++++ debian/manpage.sgml.ex | 154 +++++++++++++++++++ debian/manpage.xml.ex | 291 ++++++++++++++++++++++++++++++++++++ debian/menu.ex | 2 + debian/postinst.ex | 39 +++++ debian/postrm.ex | 37 +++++ debian/preinst.ex | 35 +++++ debian/prerm.ex | 38 +++++ debian/rules | 13 ++ debian/source/format | 1 + debian/watch.ex | 23 +++ 25 files changed, 1038 insertions(+) create mode 100644 debian/README.Debian create mode 100644 debian/README.source create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/emacsen-install.ex create mode 100644 debian/emacsen-remove.ex create mode 100644 debian/emacsen-startup.ex create mode 100644 debian/hmcfgusb.cron.d.ex create mode 100644 debian/hmcfgusb.default.ex create mode 100644 debian/hmcfgusb.doc-base.EX create mode 100644 debian/init.d.ex create mode 100644 debian/manpage.1.ex create mode 100644 debian/manpage.sgml.ex create mode 100644 debian/manpage.xml.ex create mode 100644 debian/menu.ex create mode 100644 debian/postinst.ex create mode 100644 debian/postrm.ex create mode 100644 debian/preinst.ex create mode 100644 debian/prerm.ex create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/watch.ex diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..ef9f2f2 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,6 @@ +hmcfgusb for Debian +------------------- + + + + -- root Thu, 19 Jun 2014 09:42:47 +0200 diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 0000000..f6df68e --- /dev/null +++ b/debian/README.source @@ -0,0 +1,9 @@ +hmcfgusb for Debian +------------------- + + + + + + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..65c8ab8 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +hmcfgusb (0.096-1) unstable; urgency=low + + * Initial release (Closes: #nnnn) + + -- root Thu, 19 Jun 2014 09:42:47 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +8 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..b2e7f87 --- /dev/null +++ b/debian/control @@ -0,0 +1,15 @@ +Source: hmcfgusb +Section: unknown +Priority: extra +Maintainer: root +Build-Depends: debhelper (>= 8.0.0) +Standards-Version: 3.9.2 +Homepage: +#Vcs-Git: git://git.debian.org/collab-maint/hmcfgusb.git +#Vcs-Browser: http://git.debian.org/?p=collab-maint/hmcfgusb.git;a=summary + +Package: hmcfgusb +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..cd74486 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,36 @@ +Format: http://dep.debian.net/deps/dep5 +Upstream-Name: hmcfgusb +Source: + +Files: * +Copyright: + +License: + + + . + + +# If you want to use GPL v2 or later for the /debian/* files use +# the following clauses, or change it to suit. Delete these two lines +Files: debian/* +Copyright: 2014 root +License: GPL-2+ + This package 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 package 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, see + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.md diff --git a/debian/emacsen-install.ex b/debian/emacsen-install.ex new file mode 100644 index 0000000..f151dbb --- /dev/null +++ b/debian/emacsen-install.ex @@ -0,0 +1,45 @@ +#! /bin/sh -e +# /usr/lib/emacsen-common/packages/install/hmcfgusb + +# Written by Jim Van Zandt , borrowing heavily +# from the install scripts for gettext by Santiago Vila +# and octave by Dirk Eddelbuettel . + +FLAVOR=$1 +PACKAGE=hmcfgusb + +if [ ${FLAVOR} = emacs ]; then exit 0; fi + +echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} + +#FLAVORTEST=`echo $FLAVOR | cut -c-6` +#if [ ${FLAVORTEST} = xemacs ] ; then +# SITEFLAG="-no-site-file" +#else +# SITEFLAG="--no-site-file" +#fi +FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile" + +ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} +ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} + +# Install-info-altdir does not actually exist. +# Maybe somebody will write it. +if test -x /usr/sbin/install-info-altdir; then + echo install/${PACKAGE}: install Info links for ${FLAVOR} + install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/share/info/${PACKAGE}.info.gz +fi + +install -m 755 -d ${ELCDIR} +cd ${ELDIR} +FILES=`echo *.el` +cp ${FILES} ${ELCDIR} +cd ${ELCDIR} + +cat << EOF > path.el +(setq load-path (cons "." load-path) byte-compile-warnings nil) +EOF +${FLAVOR} ${FLAGS} ${FILES} +rm -f *.el path.el + +exit 0 diff --git a/debian/emacsen-remove.ex b/debian/emacsen-remove.ex new file mode 100644 index 0000000..d63897d --- /dev/null +++ b/debian/emacsen-remove.ex @@ -0,0 +1,15 @@ +#!/bin/sh -e +# /usr/lib/emacsen-common/packages/remove/hmcfgusb + +FLAVOR=$1 +PACKAGE=hmcfgusb + +if [ ${FLAVOR} != emacs ]; then + if test -x /usr/sbin/install-info-altdir; then + echo remove/${PACKAGE}: removing Info links for ${FLAVOR} + install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/share/info/hmcfgusb.info.gz + fi + + echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} + rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} +fi diff --git a/debian/emacsen-startup.ex b/debian/emacsen-startup.ex new file mode 100644 index 0000000..baffe3c --- /dev/null +++ b/debian/emacsen-startup.ex @@ -0,0 +1,25 @@ +;; -*-emacs-lisp-*- +;; +;; Emacs startup file, e.g. /etc/emacs/site-start.d/50hmcfgusb.el +;; for the Debian hmcfgusb package +;; +;; Originally contributed by Nils Naumann +;; Modified by Dirk Eddelbuettel +;; Adapted for dh-make by Jim Van Zandt + +;; The hmcfgusb package follows the Debian/GNU Linux 'emacsen' policy and +;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, +;; xemacs19, emacs20, xemacs20...). The compiled code is then +;; installed in a subdirectory of the respective site-lisp directory. +;; We have to add this to the load-path: +(let ((package-dir (concat "/usr/share/" + (symbol-name flavor) + "/site-lisp/hmcfgusb"))) +;; If package-dir does not exist, the hmcfgusb package must have +;; removed but not purged, and we should skip the setup. + (when (file-directory-p package-dir) + (setq load-path (cons package-dir load-path)) + (autoload 'hmcfgusb-mode "hmcfgusb-mode" + "Major mode for editing hmcfgusb files." t) + (add-to-list 'auto-mode-alist '("\\.hmcfgusb$" . hmcfgusb-mode)))) + diff --git a/debian/hmcfgusb.cron.d.ex b/debian/hmcfgusb.cron.d.ex new file mode 100644 index 0000000..3966b20 --- /dev/null +++ b/debian/hmcfgusb.cron.d.ex @@ -0,0 +1,4 @@ +# +# Regular cron jobs for the hmcfgusb package +# +0 4 * * * root [ -x /usr/bin/hmcfgusb_maintenance ] && /usr/bin/hmcfgusb_maintenance diff --git a/debian/hmcfgusb.default.ex b/debian/hmcfgusb.default.ex new file mode 100644 index 0000000..5fcb36c --- /dev/null +++ b/debian/hmcfgusb.default.ex @@ -0,0 +1,10 @@ +# Defaults for hmcfgusb initscript +# sourced by /etc/init.d/hmcfgusb +# installed at /etc/default/hmcfgusb by the maintainer scripts + +# +# This is a POSIX shell fragment +# + +# Additional options that are passed to the Daemon. +DAEMON_OPTS="" diff --git a/debian/hmcfgusb.doc-base.EX b/debian/hmcfgusb.doc-base.EX new file mode 100644 index 0000000..6bbf3c9 --- /dev/null +++ b/debian/hmcfgusb.doc-base.EX @@ -0,0 +1,20 @@ +Document: hmcfgusb +Title: Debian hmcfgusb Manual +Author: +Abstract: This manual describes what hmcfgusb is + and how it can be used to + manage online manuals on Debian systems. +Section: unknown + +Format: debiandoc-sgml +Files: /usr/share/doc/hmcfgusb/hmcfgusb.sgml.gz + +Format: postscript +Files: /usr/share/doc/hmcfgusb/hmcfgusb.ps.gz + +Format: text +Files: /usr/share/doc/hmcfgusb/hmcfgusb.text.gz + +Format: HTML +Index: /usr/share/doc/hmcfgusb/html/index.html +Files: /usr/share/doc/hmcfgusb/html/*.html diff --git a/debian/init.d.ex b/debian/init.d.ex new file mode 100644 index 0000000..5de45af --- /dev/null +++ b/debian/init.d.ex @@ -0,0 +1,154 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: hmcfgusb +# Required-Start: $network $local_fs +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: +# Description: +# <...> +# <...> +### END INIT INFO + +# Author: root + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC=hmcfgusb # Introduce a short description here +NAME=hmcfgusb # Introduce the short server's name here +DAEMON=/usr/sbin/hmcfgusb # Introduce the server's location here +DAEMON_ARGS="" # Arguments to run the daemon with +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x $DAEMON ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS \ + || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/debian/manpage.1.ex b/debian/manpage.1.ex new file mode 100644 index 0000000..b2453a7 --- /dev/null +++ b/debian/manpage.1.ex @@ -0,0 +1,59 @@ +.\" 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 HMCFGUSB SECTION "June 19, 2014" +.\" 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 +hmcfgusb \- program to do something +.SH SYNOPSIS +.B hmcfgusb +.RI [ options ] " files" ... +.br +.B bar +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B hmcfgusb +and +.B bar +commands. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBhmcfgusb\fP is a program that... +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR bar (1), +.BR baz (1). +.br +The programs are documented fully by +.IR "The Rise and Fall of a Fooish Bar" , +available via the Info system. +.SH AUTHOR +hmcfgusb was written by . +.PP +This manual page was written by root , +for the Debian project (and may be used by others). diff --git a/debian/manpage.sgml.ex b/debian/manpage.sgml.ex new file mode 100644 index 0000000..1ff9fb2 --- /dev/null +++ b/debian/manpage.sgml.ex @@ -0,0 +1,154 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + FIRSTNAME"> + SURNAME"> + + June 19, 2014"> + + SECTION"> + jsurf@gmx.de"> + + HMCFGUSB"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2003 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + program to do something + + + + &dhpackage; + + + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; and bar + commands. + + This manual page was written for the &debian; distribution + because the original program does not have a manual page. + Instead, it has documentation in the &gnu; + Info format; see below. + + &dhpackage; is a program that... + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + Info files. + + + + + + + + Show summary of options. + + + + + + + + Show version of program. + + + + + + SEE ALSO + + bar (1), baz (1). + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + Info system. + + + AUTHOR + + This manual page was written by &dhusername; &dhemail; for + the &debian; system (and may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; General Public License, Version 2 any + later version published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL. + + + +
+ + diff --git a/debian/manpage.xml.ex b/debian/manpage.xml.ex new file mode 100644 index 0000000..c632c4b --- /dev/null +++ b/debian/manpage.xml.ex @@ -0,0 +1,291 @@ + +.
will be generated. You may view the +manual page with: nroff -man .
| less'. A typical entry +in a Makefile or Makefile.am is: + +DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/docbook-xsl/manpages/docbook.xsl +XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0" + +manpage.1: manpage.xml + $(XP) $(DB2MAN) $< + +The xsltproc binary is found in the xsltproc package. The XSL files are in +docbook-xsl. A description of the parameters you can use can be found in the +docbook-xsl-doc-* packages. Please remember that if you create the nroff +version in one of the debian/rules file targets (such as build), you will need +to include xsltproc and docbook-xsl in your Build-Depends control field. +Alternatively use the xmlto command/package. That will also automatically +pull in xsltproc and docbook-xsl. + +Notes for using docbook2x: docbook2x-man does not automatically create the +AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as + ... . + +To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections +read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be +found in the docbook-xsl-doc-html package. + +Validation can be done using: `xmllint -''-noout -''-valid manpage.xml` + +General documentation about man-pages and man-page-formatting: +man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ + +--> + + + + + + + + + + + + + +]> + + + + &dhtitle; + &dhpackage; + + + &dhfirstname; + &dhsurname; + Wrote this manpage for the Debian system. +
+ &dhemail; +
+
+
+ + 2007 + &dhusername; + + + This manual page was written for the Debian system + (and may be used by others). + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU General Public License, + Version 2 or (at your option) any later version published by + the Free Software Foundation. + On Debian systems, the complete text of the GNU General Public + License can be found in + /usr/share/common-licenses/GPL. + +
+ + &dhucpackage; + &dhsection; + + + &dhpackage; + program to do something + + + + &dhpackage; + + + + + + + + + this + + + + + + + + this + that + + + + + &dhpackage; + + + + + + + + + + + + + + + + + + + DESCRIPTION + This manual page documents briefly the + &dhpackage; and bar + commands. + This manual page was written for the Debian distribution + because the original program does not have a manual page. + Instead, it has documentation in the GNU + info + 1 + format; see below. + &dhpackage; is a program that... + + + OPTIONS + The program follows the usual GNU command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + + info + 1 + files. + + + + + + + Does this and that. + + + + + + + Show summary of options. + + + + + + + Show version of program. + + + + + + FILES + + + /etc/foo.conf + + The system-wide configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + ${HOME}/.foo.conf + + The per-user configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + + + ENVIONMENT + + + FOO_CONF + + If used, the defined file is used as configuration + file (see also ). + + + + + + DIAGNOSTICS + The following diagnostics may be issued + on stderr: + + + Bad configuration file. Exiting. + + The configuration file seems to contain a broken configuration + line. Use the option, to get more info. + + + + + &dhpackage; provides some return codes, that can + be used in scripts: + + Code + Diagnostic + + 0 + Program exited successfully. + + + 1 + The configuration file seems to be broken. + + + + + + BUGS + The program is currently limited to only work + with the foobar library. + The upstreams BTS can be found + at . + + + SEE ALSO + + + bar + 1 + , + baz + 1 + , + foo.conf + 5 + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + info + 1 + system. + +
+ diff --git a/debian/menu.ex b/debian/menu.ex new file mode 100644 index 0000000..44bfadb --- /dev/null +++ b/debian/menu.ex @@ -0,0 +1,2 @@ +?package(hmcfgusb):needs="X11|text|vc|wm" section="Applications/see-menu-manual"\ + title="hmcfgusb" command="/usr/bin/hmcfgusb" diff --git a/debian/postinst.ex b/debian/postinst.ex new file mode 100644 index 0000000..9a1a069 --- /dev/null +++ b/debian/postinst.ex @@ -0,0 +1,39 @@ +#!/bin/sh +# postinst script for hmcfgusb +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/postrm.ex b/debian/postrm.ex new file mode 100644 index 0000000..5336606 --- /dev/null +++ b/debian/postrm.ex @@ -0,0 +1,37 @@ +#!/bin/sh +# postrm script for hmcfgusb +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/preinst.ex b/debian/preinst.ex new file mode 100644 index 0000000..5658d1e --- /dev/null +++ b/debian/preinst.ex @@ -0,0 +1,35 @@ +#!/bin/sh +# preinst script for hmcfgusb +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/prerm.ex b/debian/prerm.ex new file mode 100644 index 0000000..4c7a665 --- /dev/null +++ b/debian/prerm.ex @@ -0,0 +1,38 @@ +#!/bin/sh +# prerm script for hmcfgusb +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..b760bee --- /dev/null +++ b/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/watch.ex b/debian/watch.ex new file mode 100644 index 0000000..283a84b --- /dev/null +++ b/debian/watch.ex @@ -0,0 +1,23 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# See uscan(1) for format + +# Compulsory line, this is a version 3 file +version=3 + +# Uncomment to examine a Webpage +# +#http://www.example.com/downloads.php hmcfgusb-(.*)\.tar\.gz + +# Uncomment to examine a Webserver directory +#http://www.example.com/pub/hmcfgusb-(.*)\.tar\.gz + +# Uncommment to examine a FTP server +#ftp://ftp.example.com/pub/hmcfgusb-(.*)\.tar\.gz debian uupdate + +# Uncomment to find new files on sourceforge, for devscripts >= 2.9 +# http://sf.net/hmcfgusb/hmcfgusb-(.*)\.tar\.gz + +# Uncomment to find new files on GooglePages +# http://example.googlepages.com/foo.html hmcfgusb-(.*)\.tar\.gz -- 2.39.5 From d033bdb303afa32f5a022f817bb9af238da803ce Mon Sep 17 00:00:00 2001 From: JSurf Date: Thu, 19 Jun 2014 13:51:48 +0200 Subject: [PATCH 13/16] Add compiled binaries to install --- debian/install | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 debian/install diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..b9cc087 --- /dev/null +++ b/debian/install @@ -0,0 +1,4 @@ +flash-hmcfgusb opt/hm/hmcfgusb +flash-ota opt/hm/hmcfgusb +hmland opt/hm/hmcfgusb +hmsniff opt/hm/hmcfgusb -- 2.39.5 From 21ce819a15c3a17a5350d9d493537980791df3d4 Mon Sep 17 00:00:00 2001 From: JSurf Date: Thu, 19 Jun 2014 13:49:05 +0200 Subject: [PATCH 14/16] Add init script for hmland --- debian/control | 10 +++++----- debian/{init.d.ex => hmland.init} | 14 +++++++------- debian/rules | 3 +++ 3 files changed, 15 insertions(+), 12 deletions(-) rename debian/{init.d.ex => hmland.init} (90%) diff --git a/debian/control b/debian/control index b2e7f87..0bd2041 100644 --- a/debian/control +++ b/debian/control @@ -1,12 +1,12 @@ Source: hmcfgusb Section: unknown Priority: extra -Maintainer: root -Build-Depends: debhelper (>= 8.0.0) +Maintainer: JSurf +Build-Depends: debhelper (>= 8.0.0), libusb-1.0-0-dev Standards-Version: 3.9.2 -Homepage: -#Vcs-Git: git://git.debian.org/collab-maint/hmcfgusb.git -#Vcs-Browser: http://git.debian.org/?p=collab-maint/hmcfgusb.git;a=summary +Homepage: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb +#Vcs-Git: https://github.com/JSUrf/hmcfgusb.git +#Vcs-Browser: https://github.com/JSurf/hmcfgusb Package: hmcfgusb Architecture: any diff --git a/debian/init.d.ex b/debian/hmland.init similarity index 90% rename from debian/init.d.ex rename to debian/hmland.init index 5de45af..7f8f6d3 100644 --- a/debian/init.d.ex +++ b/debian/hmland.init @@ -1,8 +1,8 @@ #!/bin/sh ### BEGIN INIT INFO -# Provides: hmcfgusb -# Required-Start: $network $local_fs -# Required-Stop: +# Provides: hmland +# Required-Start: $network $local_fs $remote_fs +# Required-Stop: $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: @@ -15,10 +15,10 @@ # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC=hmcfgusb # Introduce a short description here -NAME=hmcfgusb # Introduce the short server's name here -DAEMON=/usr/sbin/hmcfgusb # Introduce the server's location here -DAEMON_ARGS="" # Arguments to run the daemon with +DESC="Homematic LAN Adapter service" # Introduce a short description here +NAME=hmland # Introduce the short server's name here +DAEMON=/opt/hm/hmcfgusb/$NAME # Introduce the server's location here +DAEMON_ARGS="-r 03:30 -d -P -p 1000" # Arguments to run the daemon with PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME diff --git a/debian/rules b/debian/rules index b760bee..4d5943c 100755 --- a/debian/rules +++ b/debian/rules @@ -11,3 +11,6 @@ %: dh $@ + +override_dh_installinit: + dh_installinit --name=hmland \ No newline at end of file -- 2.39.5 From 2ba9d831359dece9306240f347927d7e07929eb8 Mon Sep 17 00:00:00 2001 From: JSurf Date: Thu, 19 Jun 2014 15:07:13 +0200 Subject: [PATCH 15/16] Try to fix some lintian warnings and errors --- debian/README.Debian | 6 ------ debian/README.source | 9 -------- debian/changelog | 6 +++--- debian/control | 9 ++++---- debian/copyright | 50 ++++++++++++++++---------------------------- 5 files changed, 26 insertions(+), 54 deletions(-) delete mode 100644 debian/README.Debian delete mode 100644 debian/README.source diff --git a/debian/README.Debian b/debian/README.Debian deleted file mode 100644 index ef9f2f2..0000000 --- a/debian/README.Debian +++ /dev/null @@ -1,6 +0,0 @@ -hmcfgusb for Debian -------------------- - - - - -- root Thu, 19 Jun 2014 09:42:47 +0200 diff --git a/debian/README.source b/debian/README.source deleted file mode 100644 index f6df68e..0000000 --- a/debian/README.source +++ /dev/null @@ -1,9 +0,0 @@ -hmcfgusb for Debian -------------------- - - - - - - diff --git a/debian/changelog b/debian/changelog index 65c8ab8..d1a6d51 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,5 @@ -hmcfgusb (0.096-1) unstable; urgency=low +hmcfgusb (0.097-1) unstable; urgency=low - * Initial release (Closes: #nnnn) + * Initial release - -- root Thu, 19 Jun 2014 09:42:47 +0200 + -- JSurf Thu, 19 Jun 2014 09:42:47 +0200 diff --git a/debian/control b/debian/control index 0bd2041..83727ae 100644 --- a/debian/control +++ b/debian/control @@ -1,9 +1,9 @@ Source: hmcfgusb -Section: unknown +Section: misc Priority: extra Maintainer: JSurf Build-Depends: debhelper (>= 8.0.0), libusb-1.0-0-dev -Standards-Version: 3.9.2 +Standards-Version: 3.9.3 Homepage: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb #Vcs-Git: https://github.com/JSUrf/hmcfgusb.git #Vcs-Browser: https://github.com/JSurf/hmcfgusb @@ -11,5 +11,6 @@ Homepage: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb Package: hmcfgusb Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Description: - +Description: hmland daemon and utilities + utilities to use the HM-CFG-USB(2) (HomeMatic USB Konfigurations-Adapter) + from ELV on Linux/Unix by using libusb 1.0. diff --git a/debian/copyright b/debian/copyright index cd74486..4916258 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,36 +1,22 @@ Format: http://dep.debian.net/deps/dep5 Upstream-Name: hmcfgusb -Source: +Source: Files: * -Copyright: - -License: - - - . - - -# If you want to use GPL v2 or later for the /debian/* files use -# the following clauses, or change it to suit. Delete these two lines -Files: debian/* -Copyright: 2014 root -License: GPL-2+ - This package 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 package 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, see - . - On Debian systems, the complete text of the GNU General - Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". - -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +Copyright: 2013 Michael Gernoth +License: Open Source + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. \ No newline at end of file -- 2.39.5 From ff1fb96a897030301c403de0189279ad5a5eed1d Mon Sep 17 00:00:00 2001 From: bullshit Date: Fri, 20 Jun 2014 20:16:00 +0200 Subject: [PATCH 16/16] adding log command to daemon --- debian/hmland.init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/hmland.init b/debian/hmland.init index 7f8f6d3..dd0dd0e 100644 --- a/debian/hmland.init +++ b/debian/hmland.init @@ -18,7 +18,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="Homematic LAN Adapter service" # Introduce a short description here NAME=hmland # Introduce the short server's name here DAEMON=/opt/hm/hmcfgusb/$NAME # Introduce the server's location here -DAEMON_ARGS="-r 03:30 -d -P -p 1000" # Arguments to run the daemon with +DAEMON_ARGS="-r 03:30 -d -P -p 1000 -L /var/log/hmland.log" # Arguments to run the daemon with PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME -- 2.39.5