Skip to content

Commit

Permalink
fixed issue that hmlangw puts rf-module copro into bootloader mode it…
Browse files Browse the repository at this point in the history
…self while multimacd is already doing that (#2350, @jp112sdl)
  • Loading branch information
jp112sdl authored Jul 26, 2023
1 parent 20404f9 commit f80ce43
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion buildroot-external/package/hmlangw/S61hmlangw
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ HM_HMRF_MMDNODE=/dev/mmd_bidcos
start() {
echo -n "Starting LAN Gateway Daemon: "
if [[ -c ${HM_HMRF_DEVNODE} ]]; then
if start-stop-daemon -S -b -m -p ${PIDFILE} --startas /bin/sh -- -c "exec /bin/${DAEMON} -n ${HM_HMRF_SERIAL} -s ${HM_HMRF_MMDNODE} -r -1 >/var/log/${DAEMON}.log 2>&1"; then
if start-stop-daemon -S -b -m -p ${PIDFILE} --startas /bin/sh -- -c "exec /bin/${DAEMON} -b -n ${HM_HMRF_SERIAL} -s ${HM_HMRF_MMDNODE} -r -1 >/var/log/${DAEMON}.log 2>&1"; then
echo "OK"
else
echo "FAIL"
Expand Down
11 changes: 10 additions & 1 deletion buildroot-external/package/hmlangw/hmframe.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* HM-LGW emulation for HM-MOD-RPI
*
* Copyright (c) 2015-2023 Oliver Kastl, Jens Maus
* Copyright (c) 2015-2023 Oliver Kastl, Jens Maus, Jérôme Pech
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
Expand Down Expand Up @@ -30,6 +30,7 @@
#include "hmframe.h"

extern bool g_debug;
extern bool g_disableEnterBootloader;
extern void dump_data( const char* data, int length );

int writeall( int fd, const void *buffer, int len )
Expand Down Expand Up @@ -65,6 +66,14 @@ static const unsigned char bootloaderReply2[] =

int sendEnterBootloader( int fd )
{
if (g_disableEnterBootloader)
{
if( g_debug )
fprintf( stderr, "sendEnterBootloader not executed, because disabled (-b option is set).\n");

return 0;
}

if( g_debug )
fprintf( stderr, "sendEnterBootloader(%d)\n", fd);

Expand Down
13 changes: 9 additions & 4 deletions buildroot-external/package/hmlangw/hmlangw.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* HM-LGW emulation for HM-MOD-RPI
*
* Copyright (c) 2015-2023 Oliver Kastl, Jens Maus
* Copyright (c) 2015-2023 Oliver Kastl, Jens Maus, Jérôme Pech
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
Expand Down Expand Up @@ -52,11 +52,12 @@ static int g_serialFd = -1;
static int g_termEventFd = -1;
static int g_resetFileFd = -1;
bool g_debug = false;
bool g_disableEnterBootloader=false;
static bool g_inBootloader = false;

//const char *g_productString = "01,eQ3-HM-LGW,1.1.4,ABC0123456";

#define VERSION "1.0.0"
#define VERSION "1.0.1"
static char *g_address=NULL;
static const char *g_productString = "01,Revilo-HM-LGW," VERSION ",%s\r\n";

Expand Down Expand Up @@ -696,6 +697,7 @@ void hmlangw_syntax(char *prog)
fprintf(stderr, "\t-r\tHM-MOD-RPI reset GPIO pin (default 18, -1 to disable)\n");
fprintf(stderr, "\t-D\tdebug mode\n");
fprintf(stderr, "\t-x\texecute HM-MOD-RPI reset and exit\n");
fprintf(stderr, "\t-b\tdo not put CoPro in bootloader mode\n");
fprintf(stderr, "\t-h\tthis help\n");
fprintf(stderr, "\t-l ip\tlisten on given IP address only (for example 127.0.0.1)\n");
fprintf(stderr, "\t-u\tupdate firmware of HM-MOD-RPI\n");
Expand Down Expand Up @@ -778,13 +780,16 @@ int main(int argc, char **argv)
bool forceUpdateFirmware = false;
bool startThreads = true;

while((opt = getopt(argc, argv, "DVs:r:l:n:xuf")) != -1)
while((opt = getopt(argc, argv, "DbVs:r:l:n:xuf")) != -1)
{
switch (opt)
{
case 'D':
g_debug = true;
break;
case 'b':
g_disableEnterBootloader = true;
break;
case 's':
serialName = optarg;
break;
Expand Down Expand Up @@ -845,7 +850,7 @@ int main(int argc, char **argv)
break;
case 'V':
printf("hmlangw " VERSION "\n");
printf("Copyright (c) 2015-2023 Oliver Kastl, Jens Maus\n\n");
printf("Copyright (c) 2015-2023 Oliver Kastl, Jens Maus, Jérôme Pech\n\n");
exit(EXIT_SUCCESS);
case 'h':
case ':':
Expand Down

0 comments on commit f80ce43

Please sign in to comment.