From dc9f58f02b49575ad6de45626468a7f55dd57a12 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Tue, 30 Jun 2015 13:40:45 +0200 Subject: [PATCH] hmland: don't impersonate HM-CFG-LAN by default. Don't respond to K-commands with HM-LAN-IF by default but respond with the actual string returned by the USB device (HM-USB-IF). This breaks compatibility with Fhem-versions before 2015-06-19 and possibly other software (Homegear, eQ-3 rfd). To restore compatibility with these software-packages, add the new command-line switch "-I" which restores old behaviour. --- hmland.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hmland.c b/hmland.c index 97a5b6c..73a08d4 100644 --- a/hmland.c +++ b/hmland.c @@ -718,8 +718,6 @@ static int socket_server(char *iface, int port, int flags) exit(EXIT_FAILURE); } - impersonate_hmlanif = 1; - sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (sock == -1) { perror("Can't open socket"); @@ -813,6 +811,7 @@ void hmlan_syntax(char *prog) fprintf(stderr, "\t-D\t\tdebug mode\n"); fprintf(stderr, "\t-d\t\tdaemon mode\n"); fprintf(stderr, "\t-h\t\tthis help\n"); + fprintf(stderr, "\t-I\t\tpretend to be HM-LAN-IF for compatibility with client-software (previous default)\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"); @@ -834,7 +833,7 @@ int main(int argc, char **argv) char *ep; int opt; - while((opt = getopt(argc, argv, "DdhiPp:Rr:l:L:vV")) != -1) { + while((opt = getopt(argc, argv, "DdhIiPp:Rr:l:L:vV")) != -1) { switch (opt) { case 'D': debug = 1; @@ -843,6 +842,9 @@ int main(int argc, char **argv) case 'd': flags |= FLAG_DAEMON; break; + case 'I': + impersonate_hmlanif = 1; + break; case 'i': interactive = 1; break; @@ -894,7 +896,7 @@ int main(int argc, char **argv) break; case 'V': printf("hmland " VERSION "\n"); - printf("Copyright (c) 2013 Michael Gernoth\n\n"); + printf("Copyright (c) 2013-15 Michael Gernoth\n\n"); exit(EXIT_SUCCESS); case 'h': case ':': -- 2.39.5