Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeakes committed Sep 1, 2024
1 parent 336224a commit d4397f8
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 28 deletions.
Binary file added release/aqualinkd-amd64
Binary file not shown.
Binary file modified release/aqualinkd-arm64
Binary file not shown.
Binary file modified release/aqualinkd-armhf
Binary file not shown.
9 changes: 7 additions & 2 deletions release/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ if [ "$PARENT_COMMAND" != "make" ] && [ "$1" != "from-make" ] && [ "$1" != "igno
BINEXT="-armhf"
;;
*)
echo "Arch $ARCH is unknown, Default to using 32bit HF AqualinkD, you may need to manually try ./release/aqualnkd_arm64"
BINEXT=""
if [ -f $BUILD/$SOURCEBIN-$ARCH ]; then
echo "Arch $ARCH is not officially supported, but we found a suitable binary"
BINEXT="-$ARCH"
else
echo "Arch $ARCH is unknown, Default to using 32bit HF AqualinkD, you may need to manually try ./release/aqualnkd_arm64"
BINEXT=""
fi
;;
esac

Expand Down
Binary file added release/serial_logger-amd64
Binary file not shown.
Binary file modified release/serial_logger-arm64
Binary file not shown.
Binary file modified release/serial_logger-armhf
Binary file not shown.
4 changes: 2 additions & 2 deletions source/aq_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ void send_packet(int fd, unsigned char *packet, int length)
*/

// MAYBE Change this back to debug serial
LOG(RSSD_LOG,LOG_DEBUG_SERIAL, "Serial write %d bytes\n",length-2);
//LOG(RSSD_LOG,LOG_DEBUG_SERIAL, "Serial write %d bytes\n",length-2);
//LOG(RSSD_LOG,LOG_DEBUG, "Serial write %d bytes, type 0x%02hhx cmd 0x%02hhx\n",length-2,packet[5],packet[6]);
if (_aqconfig_.log_protocol_packets || getLogLevel(RSSD_LOG) >= LOG_DEBUG_SERIAL)
logPacketWrite(&packet[1], length-2);
Expand Down Expand Up @@ -1189,7 +1189,7 @@ int get_packet(int fd, unsigned char* packet)

//clock_gettime(CLOCK_REALTIME, &last_serial_read_time);
//}
LOG(RSSD_LOG,LOG_DEBUG_SERIAL, "Serial read %d bytes\n",index);
//LOG(RSSD_LOG,LOG_DEBUG_SERIAL, "Serial read %d bytes\n",index);
if (_aqconfig_.log_protocol_packets || getLogLevel(RSSD_LOG) >= LOG_DEBUG_SERIAL)
logPacketRead(packet, index);
// Return the packet length.
Expand Down
5 changes: 3 additions & 2 deletions source/iaqtouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,13 @@ bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkd
//char buff[1024];
// NSF Take this out

/*
if ( packet[3] != CMD_IAQ_POLL && getLogLevel(IAQT_LOG) >= LOG_DEBUG ) {
//if ( getLogLevel(IAQT_LOG) >= LOG_DEBUG ) {
char buff[1024];
beautifyPacket(buff, 1024, packet, length, false);
beautifyPacket(buff, 1024, packet, length, true);
LOG(IAQT_LOG,LOG_DEBUG, "Received message : %s", buff);
}
}*/


if (packet[PKT_CMD] == CMD_IAQ_PAGE_START) {
Expand Down
4 changes: 4 additions & 0 deletions source/json_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ int build_device_JSON(struct aqualinkdata *aqdata, char* buffer, int size, bool
int logmaskjsonobject(logmask_t flag, char* buffer)
{
int length = sprintf(buffer, "{\"name\":\"%s\",\"id\":\"%d\",\"set\":\"%s\"},", logmask2name(flag), flag,(isDebugLogMaskSet(flag)?JSON_ON:JSON_OFF));

if (flag == RSSD_LOG) {
length = sprintf(buffer, "{\"name\":\"%s\",\"id\":\"%d\",\"set\":\"%s\",\"filter\":\"0x%02hhx\"},", logmask2name(flag), flag,(isDebugLogMaskSet(flag)?JSON_ON:JSON_OFF), _aqconfig_.RSSD_LOG_filter);
}
return length;
}
int logleveljsonobject(int level, char* buffer)
Expand Down
4 changes: 4 additions & 0 deletions source/packetLogger.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ void _logPacket(logmask_t from, unsigned char *packet_buffer, int packet_length,
lastPacketTo = packet_buffer[PKT_DEST];
}

if (is_read)
LOG(from,LOG_DEBUG_SERIAL, "Serial read %d bytes\n",packet_length);
else
LOG(from,LOG_DEBUG_SERIAL, "Serial write %d bytes\n",packet_length);

//char buff[1000];
char buff[LARGELOGBUFFER];
Expand Down
39 changes: 20 additions & 19 deletions source/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
#endif

#include "utils.h"
#include "rs_msg_utils.h"
#include "aq_serial.h"

#define DEFAULT_LOG_FILE "/tmp/aqualinkd-inline.log"
//#define MAXCFGLINE 265
Expand Down Expand Up @@ -197,7 +199,7 @@ void LOGSystemError (int errnum, logmask_t from, const char *on_what)
if (_daemonise == TRUE)
{
//logMessage (LOG_ERR, "%d : %s", errno, on_what);
LOG(AQUA_LOG, LOG_ERR, "%s (%d) : %s\n", strerror (errno), errno, on_what);
LOG(from, LOG_ERR, "%s (%d) : %s\n", strerror (errno), errno, on_what);
closelog ();
}
}
Expand Down Expand Up @@ -502,7 +504,7 @@ bool isDebugLogMaskSet(logmask_t flag)
return _logforcemask & flag;
}

void _LOG(logmask_t from, int msg_level, char * message);
void _LOG(logmask_t from, int msg_level, char * message, int message_buffer_size);

/*
void logMessage(int msg_level, const char *format, ...)
Expand Down Expand Up @@ -539,7 +541,13 @@ void LOG_LARGEMSG(const logmask_t from, const int msg_level, const char *message

strncpy(&buffer[LOG_OFFSET], message, LARGELOGBUFFER);

_LOG(from, msg_level, buffer);
int len = rsm_strncpy(&buffer[LOG_OFFSET], (unsigned char*)message, LARGELOGBUFFER, message_length);

if (len >= LARGELOGBUFFER) {
sprintf(&buffer[LARGELOGBUFFER + LOG_OFFSET - 4], "...\n");
}

_LOG(from, msg_level, buffer, LARGELOGBUFFER + LOG_OFFSET);
}

void LOG(const logmask_t from, const int msg_level, const char * format, ...)
Expand All @@ -560,17 +568,17 @@ void LOG(const logmask_t from, const int msg_level, const char * format, ...)
memset(buffer, ' ', LOG_OFFSET * sizeof(char));

//vsprintf (&buffer[20], format, args);
int size = vsnprintf (&buffer[LOG_OFFSET], LOGBUFFER-LOG_OFFSET-10, format, args);
int size = vsnprintf (&buffer[LOG_OFFSET], LOGBUFFER-LOG_OFFSET-4, format, args);
va_end(args);
if (size >= LOGBUFFER-LOG_OFFSET-10 ) {
sprintf(&buffer[LOGBUFFER-11], ".........\n");
if (size >= LOGBUFFER-LOG_OFFSET-4 ) {
sprintf(&buffer[LOGBUFFER-5], "...\n");
}

_LOG(from, msg_level, buffer);
_LOG(from, msg_level, buffer, LOGBUFFER);
}


void _LOG(logmask_t from, int msg_level, char *message)
void _LOG(logmask_t from, int msg_level, char *message, int message_buffer_size)
{
/*
message should have the first LOG_OFFSET (20) characters as spaces, this allows us to add Type & From to message.
Expand All @@ -583,19 +591,10 @@ void _LOG(logmask_t from, int msg_level, char *message)

int i;

// Make all printable chars
/*
for(i = 8; i+8 < strlen(&message[8]) && i < LOGBUFFER; i++) {
if ( (message[i] < 32 || message[i] > 125) && message[i] != 10 ) {
//printf ("Change %c to %c in %s\n",message[i], ' ', message);
message[i] = ' ';
}
}*/

int msglen = strlen(&message[LOG_OFFSET]);

// Fill first 20 chars and any non printable chars with a space.
for(i = 0; i < LOGBUFFER && i < (msglen+LOG_OFFSET+1) ; i++) {
for(i = 0; i < message_buffer_size && i < (msglen+LOG_OFFSET+1) ; i++) {
if (i > LOG_OFFSET && message[i] == '\0')
break;

Expand Down Expand Up @@ -662,7 +661,9 @@ void _LOG(logmask_t from, int msg_level, char *message)

// Sent the log to the UI if configured.
if (msg_level <= LOG_ERR && _loq_display_message != NULL) {
snprintf(_loq_display_message, 127, "%s\n",message);
//snprintf(_loq_display_message, AQ_MSGLONGLEN-2, "%s\n",message);
int len = rsm_strncpy(_loq_display_message, (unsigned char*)message, AQ_MSGLONGLEN-1, message_buffer_size);
_loq_display_message[len] = '\0';
}

#ifndef AQ_MANAGER
Expand Down
2 changes: 1 addition & 1 deletion source/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ typedef int32_t logmask_t;
#define DJAN_LOG (1 << 7) // Jange Device
#define DPEN_LOG (1 << 8) // Pentair Device
// misc
#define RSSD_LOG (1 << 9) // RS485 Connection /dev/ttyUSB?
#define RSSD_LOG (1 << 9) // RS485 Connection /dev/ttyUSB DO NOT CHANGE THIS, UI HARDCODED to 512.
#define PROG_LOG (1 << 10) // Programmer
#define SCHD_LOG (1 << 11) // Scheduler Timer
#define RSTM_LOG (1 << 12) // RS packet Time
Expand Down
2 changes: 1 addition & 1 deletion source/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

#define AQUALINKD_NAME "Aqualink Daemon"
#define AQUALINKD_SHORT_NAME "AqualinkD"
#define AQUALINKD_VERSION "2.3.8 (dev 0.2)"
#define AQUALINKD_VERSION "2.3.8 (dev 0.3)"
9 changes: 8 additions & 1 deletion web/aqmanager.html
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
var _panel_set = 0;
var _latestVersionAvailable = 0;
var _rssd_logmask = 0;
const RSSD_MASK_ID = 512; // Must match RSSD_LOG in utils.c

function init_collapsible() {
var coll = document.getElementsByClassName("collapsible");
Expand Down Expand Up @@ -564,13 +565,19 @@
'<span class="toggle-label">' + data['debugmasks'][obj].name + '</span>';
eCommands.appendChild(element);

if ( data['debugmasks'][obj].name.substr(0,9) == "RS Serial" ) {
//if ( data['debugmasks'][obj].name.substr(0,9) == "RS Serial" ) {
// _rssd_logmask = element_id;
if ( data['debugmasks'][obj].id == RSSD_MASK_ID) {
_rssd_logmask = element_id;
element = document.createElement('div');
element.style.marginTop = '1px';
element.style.marginBottom = '2px'; // = 'style="margin-left: 5px';
element.innerHTML = '<input id="rssd_filter" type="text" value="" size="4" maxlength="4">&nbsp;RS Serial Filter ID <font size="-2">(Eg 0x10)</font></input>';
eCommands.appendChild(element);
if (data['debugmasks'][obj].filter != "0x00"){
//var filter = document.getElementById("rssd_filter").value;
document.getElementById("rssd_filter").value = data['debugmasks'][obj].filter;
}
}
}
settoggle(element_id, data['debugmasks'][obj].set);
Expand Down

0 comments on commit d4397f8

Please sign in to comment.