From 19fbd3cc967082e37255e96ef22203ce89624fd5 Mon Sep 17 00:00:00 2001 From: Gilles Pilloud Date: Wed, 12 Dec 2018 09:53:24 +0100 Subject: [PATCH 1/3] ref brocaar/lora-app-server#277 fix logrotate processing by using a >> operator instead of > --- packaging/files/lora-gateway-bridge.init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/files/lora-gateway-bridge.init b/packaging/files/lora-gateway-bridge.init index 13b7b2d8..e733f2bf 100644 --- a/packaging/files/lora-gateway-bridge.init +++ b/packaging/files/lora-gateway-bridge.init @@ -37,7 +37,7 @@ if [ -r /etc/default/rcS ]; then fi function do_start { - start-stop-daemon --start --background --chuid "$DAEMON_USER:$DAEMON_GROUP" --make-pidfile --pidfile "$PID_FILE" --startas /bin/bash -- -c "exec $DAEMON > /var/log/$NAME/$NAME.log 2>&1" + start-stop-daemon --start --background --chuid "$DAEMON_USER:$DAEMON_GROUP" --make-pidfile --pidfile "$PID_FILE" --startas /bin/bash -- -c "exec $DAEMON >> /var/log/$NAME/$NAME.log 2>&1" } function do_stop { From 413ca75d8d18b80383566e33514c5acca889868a Mon Sep 17 00:00:00 2001 From: Gilles Pilloud Date: Tue, 5 Mar 2019 15:39:20 +0100 Subject: [PATCH 2/3] ref #104 allow brd value with value upper than 255 --- internal/gateway/semtech/packets/pull_resp.go | 4 ++-- internal/gateway/semtech/packets/push_data.go | 2 +- internal/legacy/gateway/pf_structs.go | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/gateway/semtech/packets/pull_resp.go b/internal/gateway/semtech/packets/pull_resp.go index 35fac500..fec03584 100644 --- a/internal/gateway/semtech/packets/pull_resp.go +++ b/internal/gateway/semtech/packets/pull_resp.go @@ -77,7 +77,7 @@ type TXPK struct { Size uint16 `json:"size"` // RF packet payload size in bytes (unsigned integer) NCRC bool `json:"ncrc,omitempty"` // If true, disable the CRC of the physical layer (optional) Data []byte `json:"data"` // Base64 encoded RF packet payload, padding optional - Brd uint8 `json:"brd"` // Concentrator board used for RX (unsigned integer) + Brd uint32 `json:"brd"` // Concentrator board used for RX (unsigned integer) Ant uint8 `json:"ant"` // Antenna number on which signal has been received } @@ -95,7 +95,7 @@ func GetPullRespPacket(protoVersion uint8, randomToken uint16, frame gw.Downlink Size: uint16(len(frame.PhyPayload)), Data: frame.PhyPayload, Ant: uint8(frame.TxInfo.Antenna), - Brd: uint8(frame.TxInfo.Board), + Brd: uint32(frame.TxInfo.Board), }, }, } diff --git a/internal/gateway/semtech/packets/push_data.go b/internal/gateway/semtech/packets/push_data.go index a40aecfe..df1d080f 100644 --- a/internal/gateway/semtech/packets/push_data.go +++ b/internal/gateway/semtech/packets/push_data.go @@ -247,7 +247,7 @@ type RXPK struct { Tmms *int64 `json:"tmms"` // GPS time of pkt RX, number of milliseconds since 06.Jan.1980 Tmst uint32 `json:"tmst"` // Internal timestamp of "RX finished" event (32b unsigned) Freq float64 `json:"freq"` // RX central frequency in MHz (unsigned float, Hz precision) - Brd uint8 `json:"brd"` // Concentrator board used for RX (unsigned integer) + Brd uint32 `json:"brd"` // Concentrator board used for RX (unsigned integer) AESK uint8 `json:"aesk"` //AES key index used for encrypting fine timestamps Chan uint8 `json:"chan"` // Concentrator "IF" channel used for RX (unsigned integer) RFCh uint8 `json:"rfch"` // Concentrator "RF chain" used for RX (unsigned integer) diff --git a/internal/legacy/gateway/pf_structs.go b/internal/legacy/gateway/pf_structs.go index f237aa1e..779e65f2 100644 --- a/internal/legacy/gateway/pf_structs.go +++ b/internal/legacy/gateway/pf_structs.go @@ -392,7 +392,7 @@ type RXPK struct { Tmms *int64 `json:"tmms"` // GPS time of pkt RX, number of milliseconds since 06.Jan.1980 Tmst uint32 `json:"tmst"` // Internal timestamp of "RX finished" event (32b unsigned) Freq float64 `json:"freq"` // RX central frequency in MHz (unsigned float, Hz precision) - Brd uint8 `json:"brd"` // Concentrator board used for RX (unsigned integer) + Brd uint32 `json:"brd"` // Concentrator board used for RX (unsigned integer) Chan uint8 `json:"chan"` // Concentrator "IF" channel used for RX (unsigned integer) RFCh uint8 `json:"rfch"` // Concentrator "RF chain" used for RX (unsigned integer) Stat int8 `json:"stat"` // CRC status: 1 = OK, -1 = fail, 0 = no CRC @@ -445,7 +445,7 @@ type TXPK struct { Size uint16 `json:"size"` // RF packet payload size in bytes (unsigned integer) NCRC bool `json:"ncrc,omitempty"` // If true, disable the CRC of the physical layer (optional) Data string `json:"data"` // Base64 encoded RF packet payload, padding optional - Brd uint8 `json:"brd"` // Concentrator board used for RX (unsigned integer) + Brd uint32 `json:"brd"` // Concentrator board used for RX (unsigned integer) Ant uint8 `json:"ant"` // Antenna number on which signal has been received } @@ -560,7 +560,7 @@ func newTXPKFromTXPacket(txPacket gw.TXPacketBytes) (TXPK, error) { Size: uint16(len(txPacket.PHYPayload)), Data: base64.StdEncoding.EncodeToString(txPacket.PHYPayload), Ant: uint8(txPacket.TXInfo.Antenna), - Brd: uint8(txPacket.TXInfo.Board), + Brd: uint32(txPacket.TXInfo.Board), } if txPacket.TXInfo.TimeSinceGPSEpoch != nil { From a2a0c4780b87761023527ddcdd38abea31c0eb74 Mon Sep 17 00:00:00 2001 From: Gilles Pilloud Date: Tue, 5 Mar 2019 16:49:37 +0100 Subject: [PATCH 3/3] ref #104 fix non-necessary conversion + code formatting --- internal/gateway/semtech/packets/pull_resp.go | 2 +- internal/gateway/semtech/packets/push_data.go | 2 +- internal/legacy/gateway/pf_structs.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/gateway/semtech/packets/pull_resp.go b/internal/gateway/semtech/packets/pull_resp.go index fec03584..b27973db 100644 --- a/internal/gateway/semtech/packets/pull_resp.go +++ b/internal/gateway/semtech/packets/pull_resp.go @@ -77,7 +77,7 @@ type TXPK struct { Size uint16 `json:"size"` // RF packet payload size in bytes (unsigned integer) NCRC bool `json:"ncrc,omitempty"` // If true, disable the CRC of the physical layer (optional) Data []byte `json:"data"` // Base64 encoded RF packet payload, padding optional - Brd uint32 `json:"brd"` // Concentrator board used for RX (unsigned integer) + Brd uint32 `json:"brd"` // Concentrator board used for RX (unsigned integer) Ant uint8 `json:"ant"` // Antenna number on which signal has been received } diff --git a/internal/gateway/semtech/packets/push_data.go b/internal/gateway/semtech/packets/push_data.go index df1d080f..38ce08e3 100644 --- a/internal/gateway/semtech/packets/push_data.go +++ b/internal/gateway/semtech/packets/push_data.go @@ -247,7 +247,7 @@ type RXPK struct { Tmms *int64 `json:"tmms"` // GPS time of pkt RX, number of milliseconds since 06.Jan.1980 Tmst uint32 `json:"tmst"` // Internal timestamp of "RX finished" event (32b unsigned) Freq float64 `json:"freq"` // RX central frequency in MHz (unsigned float, Hz precision) - Brd uint32 `json:"brd"` // Concentrator board used for RX (unsigned integer) + Brd uint32 `json:"brd"` // Concentrator board used for RX (unsigned integer) AESK uint8 `json:"aesk"` //AES key index used for encrypting fine timestamps Chan uint8 `json:"chan"` // Concentrator "IF" channel used for RX (unsigned integer) RFCh uint8 `json:"rfch"` // Concentrator "RF chain" used for RX (unsigned integer) diff --git a/internal/legacy/gateway/pf_structs.go b/internal/legacy/gateway/pf_structs.go index 779e65f2..544be6ef 100644 --- a/internal/legacy/gateway/pf_structs.go +++ b/internal/legacy/gateway/pf_structs.go @@ -560,7 +560,7 @@ func newTXPKFromTXPacket(txPacket gw.TXPacketBytes) (TXPK, error) { Size: uint16(len(txPacket.PHYPayload)), Data: base64.StdEncoding.EncodeToString(txPacket.PHYPayload), Ant: uint8(txPacket.TXInfo.Antenna), - Brd: uint32(txPacket.TXInfo.Board), + Brd: txPacket.TXInfo.Board, } if txPacket.TXInfo.TimeSinceGPSEpoch != nil {