minor: code style updates

This commit is contained in:
Christian W. Zuckschwerdt 2020-09-18 19:44:47 +02:00
commit 08cf63f2ba
44 changed files with 167 additions and 126 deletions

View file

@ -20,7 +20,8 @@ Note: simple 24 bit fixed ID protocol (x1527 style) and should be handled by the
#include "decoder.h"
static int akhan_rke_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int akhan_rke_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b;
int id;

View file

@ -1,6 +1,6 @@
/** @file
Generic remote Blyss DC5-UK-WH as sold by B&Q.
Copyright (C) 2016 John Jore
This program is free software; you can redistribute it and/or modify
@ -12,7 +12,7 @@
Generic remote Blyss DC5-UK-WH as sold by B&Q.
DC5-UK-WH pair with receivers, the codes used may be specific to a receiver - use with caution
warmup pulse 5552 us, 2072 gap
short is 512 us pulse, 1484 us gap
long is 1508 us pulse, 488 us gap
@ -21,7 +21,8 @@ packet gap is 6964 us
*/
#include "decoder.h"
static int blyss_callback(r_device *decoder,bitbuffer_t *bitbuffer) {
static int blyss_callback(r_device *decoder,bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b;
char id_str[16];

View file

@ -35,7 +35,8 @@ humi is 8 bit relative humidity percentage
*/
#include "decoder.h"
static int bresser_3ch_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int bresser_3ch_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b;

View file

@ -54,10 +54,11 @@ B = Battery. 0=Ok, 8=Low.
#include "decoder.h"
static const uint8_t preamble_pattern[] = { 0xaa, 0xaa, 0xaa, 0x2d, 0xd4 };
static int bresser_5in1_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
uint8_t const preamble_pattern[] = { 0xaa, 0xaa, 0xaa, 0x2d, 0xd4 };
data_t *data;
uint8_t msg[26];
uint16_t sensor_id;
@ -120,7 +121,7 @@ static int bresser_5in1_callback(r_device *decoder, bitbuffer_t *bitbuffer)
int rain_raw = (msg[23] & 0x0f) + ((msg[23] & 0xf0) >> 4) * 10 + (msg[24] & 0x0f) * 100;
float rain = rain_raw * 0.1f;
int battery_ok = ((msg[25] & 0x80) == 0);
data = data_make(
@ -154,7 +155,7 @@ static char *output_fields[] = {
"wind_dir_deg",
"rain_mm",
"mic",
NULL
NULL,
};
r_device bresser_5in1 = {

View file

@ -44,7 +44,8 @@ ffffff45 01236pHH hhhhh Encoding
#include "decoder.h"
static int calibeur_rf104_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int calibeur_rf104_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t ID;
@ -118,7 +119,7 @@ static char *output_fields[] = {
"temperature_C",
"humidity",
"mic",
NULL
NULL,
};
r_device calibeur_RF104 = {

View file

@ -21,7 +21,8 @@ May be useful for other Cardin product too
#include "decoder.h"
static int cardin_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int cardin_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
bitrow_t *bb = bitbuffer->bb;
unsigned char dip[10] = {'-','-','-','-','-','-','-','-','-', '\0'};
@ -127,7 +128,7 @@ static char *output_fields[] = {
"model",
"dipswitch",
"rbutton",
NULL
NULL,
};
r_device cardin = {

View file

@ -31,7 +31,8 @@ Note: simple 24 bit fixed ID protocol (x1527 style) and should be handled by the
#include "decoder.h"
static int chuango_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int chuango_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b;
int id;
@ -90,7 +91,7 @@ static char *output_fields[] = {
"id",
"cmd",
"cmd_id",
NULL
NULL,
};
r_device chuango = {

View file

@ -42,7 +42,8 @@ Message layout
#include "decoder.h"
static int cotech_36_7959_decode(r_device *decoder, bitbuffer_t *bitbuffer) {
static int cotech_36_7959_decode(r_device *decoder, bitbuffer_t *bitbuffer)
{
uint8_t const preamble[] = {0x01, 0x40}; // 12 bits
int r = -1;

View file

@ -29,7 +29,8 @@ Power calculations come from Nathaniel Elijah's program EfergyRPI_001.
#include "decoder.h"
static int efergy_e2_classic_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int efergy_e2_classic_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
unsigned num_bits = bitbuffer->bits_per_row[0];
uint8_t *bytes = bitbuffer->bb[0];
data_t *data;

View file

@ -38,7 +38,8 @@ static unsigned char preamble[3] = { 0xaa, 0xaa, 0xaa };
static unsigned char pkt_hdr_inverted[3] = { 0xd2, 0x2d, 0xc0 };
static unsigned char pkt_hdr[3] = { 0x2d, 0xd2, 0x00 };
static int emontx_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int emontx_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
unsigned bitpos = 0;
int events = 0;

View file

@ -62,7 +62,8 @@ There is an extra, unidentified 7th byte in WH2A packages.
Based on reverse engineering with gnu-radio and the nice article here:
http://lucsmall.com/2012/04/29/weather-station-hacking-part-2/
*/
static int fineoffset_WH2_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int fineoffset_WH2_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
bitrow_t *bb = bitbuffer->bb;
uint8_t b[6] = {0};
data_t *data;

View file

@ -1,7 +1,6 @@
/** @file
Ford Car Key.
This program 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
@ -15,16 +14,17 @@ Identifies event, but does not attempt to decrypt rolling code...
Note: this used to have a broken PWM decoding, but is now proper DMC.
The output changed and the fields are very likely not as intended.
[00] {1} 80 : 1
[01] {9} 00 80 : 00000000 1
[02] {1} 80 : 1
[03] {78} 03 e0 01 e4 e0 90 52 97 39 60
[00] {1} 80 : 1
[01] {9} 00 80 : 00000000 1
[02] {1} 80 : 1
[03] {78} 03 e0 01 e4 e0 90 52 97 39 60
*/
#include "decoder.h"
static int fordremote_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int fordremote_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *bytes;
int found = 0;

View file

@ -128,7 +128,8 @@ static int ge_coloreffects_decode(r_device *decoder, bitbuffer_t *bitbuffer, uns
GE Color Effects Remote.
@sa ge_coloreffects_decode()
*/
static int ge_coloreffects_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int ge_coloreffects_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
unsigned bitpos = 0;
int ret = 0;
int events = 0;
@ -150,7 +151,7 @@ static char *output_fields[] = {
"model",
"id",
"command",
NULL
NULL,
};
r_device ge_coloreffects = {

View file

@ -30,7 +30,8 @@ with a repeat gap of 4 pulse widths, i.e.:
#include "decoder.h"
static int generic_motion_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int generic_motion_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b;
int code;

View file

@ -22,7 +22,8 @@ Generic temperature sensor 1.
#include "decoder.h"
static int generic_temperature_sensor_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int generic_temperature_sensor_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b = bitbuffer->bb[1];
int i, device, battery, temp_raw;

View file

@ -89,8 +89,8 @@ static int gt_tmbbq05_decode(r_device *decoder, bitbuffer_t *bitbuffer)
// remove the first leading bit and extract the 4 bytes carrying the data
bitbuffer_extract_bytes(bitbuffer, r, 1, b, 32);
// Prevent false positives from 'allzero'
// reject if Checksum Id and temperature are all zero
// Prevent false positives from 'allzero'
// reject if Checksum Id and temperature are all zero
// No need to decode/extract values for simple test
if (!b[0] && !b[1] && !b[2] && !b[3]) {
if (decoder->verbose > 1) {

View file

@ -9,7 +9,7 @@
*/
/**
Hideki Temperature, Humidity, Wind, Rain sensor.
The received bits are inverted.
Every 8 bits are stuffed with a (even) parity bit.
@ -40,7 +40,8 @@ Rain:
enum sensortypes { HIDEKI_UNKNOWN, HIDEKI_TEMP, HIDEKI_TS04, HIDEKI_WIND, HIDEKI_RAIN };
static int hideki_ts04_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int hideki_ts04_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b = bitbuffer->bb[0]; // TODO: handle the 3 row, need change in PULSE_CLOCK decoding
uint8_t packet[HIDEKI_MAX_BYTES_PER_ROW];
@ -209,7 +210,7 @@ static char *output_fields[] = {
"wind_dir_deg",
"rain_mm",
"mic",
NULL
NULL,
};
r_device hideki_ts04 = {

View file

@ -42,7 +42,8 @@ Wireless Chimes
#include "decoder.h"
static int honeywell_wdb_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int honeywell_wdb_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
int row, secret_knock, relay, battery, parity;
uint8_t *bytes;
data_t *data;

View file

@ -20,7 +20,8 @@ and various flags.
#include "decoder.h"
static int ibis_beacon_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int ibis_beacon_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t search = 0xAB; // preamble is 0xAAB
uint8_t msg[32];

View file

@ -9,7 +9,7 @@
/**
IKEA Sparsnäs Energy Meter Monitor.
The IKEA Sparsnäs consists of a display unit, and a sender unit. The display unit
The IKEA Sparsnäs consists of a display unit, and a sender unit. The display unit
displays and stores the values sent by the sender unit. It is not needed for this
decoder. The sender unit is placed by the energy meter. The sender unit has an
IR photo sensor which is placed over the energy meter impulse diode. The sender
@ -21,22 +21,22 @@ unit, but usual values are 500, 1000 and 2000. This is usually indicated like
1000 imp/kWh
on the front of the meter. This value goes into ikea_sparsnas_pulses_per_kwh
on the front of the meter. This value goes into ikea_sparsnas_pulses_per_kwh
in this file. The sender also has a unique ID which is used in the encryption
key, hence it is needed here to decrypt the data. The sender ID is on a sticker
in the battery compartment. There are three groups of three digits there. The
last six digits are your sender ID. Eg "400 617 633" gives you the sender id
last six digits are your sender ID. Eg "400 617 633" gives you the sender id
617633. This number goes into IKEA_SPARSNAS_SENSOR_ID in this file.
The data is sent using CPFSK modulation. It requires PD_MIN_PULSE_SAMPLES in
The data is sent using CPFSK modulation. It requires PD_MIN_PULSE_SAMPLES in
pulse_detect.h to be lowered to 5 to be able to demodulate at 250kS/s. The
preamble is optimally 4 bytes of 0XAA. Then the sync word 0xD201. Here only
preamble is optimally 4 bytes of 0XAA. Then the sync word 0xD201. Here only
the last 2 bytes of the 0xAA preamble is checked, as the first ones seems
to be corrupted quite often. There are plenty of integrety checks made on
to be corrupted quite often. There are plenty of integrety checks made on
the demodulated package which makes this compromise OK.
Packet structure according to: https://github.com/strigeus/sparsnas_decoder
Packet structure according to: https://github.com/strigeus/sparsnas_decoder
(with some changes by myself)
0: uint8_t length; // Always 0x11
@ -54,15 +54,15 @@ Packet structure according to: https://github.com/strigeus/sparsnas_decoder
Example packet: 0x11a15f070ea2dfefe6d5fdd20547e6340ae7be61
The packet's integrety can be checked with the 16b CRC at the end of the packet.
There are also several other ways to check the integrety of the package.
The packet's integrety can be checked with the 16b CRC at the end of the packet.
There are also several other ways to check the integrety of the package.
- (preamble)
- CRC
- The decrypted sensor ID
- the constant bytes at 0, 3 and 4
The decryption, CRC is calculation, value extraction and interpretation is
taken from https://github.com/strigeus/sparsnas_decoder and adapted to
The decryption, CRC is calculation, value extraction and interpretation is
taken from https://github.com/strigeus/sparsnas_decoder and adapted to
this application. Many thanks to strigeus!
Most other things are from https://github.com/kodarn/Sparsnas which is an

View file

@ -9,10 +9,10 @@
*/
/**
Intertechno remotes.
Intertechno remote labeled ITT-1500 that came with 3x ITR-1500 remote outlets. The set is labeled IT-1500.
The PPM consists of a 220µs high followed by 340µs or 1400µs of gap.
There is another type of remotes that have an ID prefix of 0x56 and slightly shorter timing.
*/
@ -72,7 +72,7 @@ static char *output_fields[] = {
"slave",
"master",
"command",
NULL
NULL,
};
r_device intertechno = {

View file

@ -36,7 +36,8 @@ Frame structure:
#include "decoder.h"
static int kedsum_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int kedsum_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
uint8_t b[5];
data_t *data;
@ -99,7 +100,7 @@ static char *output_fields[] = {
"temperature_F",
"humidity",
"mic",
NULL
NULL,
};
r_device kedsum = {
@ -111,5 +112,5 @@ r_device kedsum = {
.reset_limit = 9400,
.decode_fn = &kedsum_callback,
.disabled = 0,
.fields = output_fields
.fields = output_fields,
};

View file

@ -29,7 +29,8 @@ Long: 860-1016 us, short: 304-560 us, older sync: 480 us, newer sync: 340 us,
#include "decoder.h"
static int kerui_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int kerui_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b;
int id;

View file

@ -152,7 +152,8 @@ static int lacrosse_it(r_device *decoder, bitbuffer_t *bitbuffer, int device29or
Wrapper for the TX29 device.
@sa lacrosse_it()
*/
static int lacrossetx29_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int lacrossetx29_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
return lacrosse_it(decoder, bitbuffer, LACROSSE_TX29_MODEL);
}
@ -160,7 +161,8 @@ static int lacrossetx29_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
Wrapper for the TX35 device.
@sa lacrosse_it()
*/
static int lacrossetx35_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int lacrossetx35_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
return lacrosse_it(decoder, bitbuffer, LACROSSE_TX35_MODEL);
}
@ -173,7 +175,7 @@ static char *output_fields[] = {
"temperature_C",
"humidity",
"mic",
NULL
NULL,
};
// Receiver for the TX29 device

View file

@ -1,6 +1,6 @@
/** @file
Wireless M-Bus (EN 13757-4).
Copyright (C) 2018 Tommy Vestermark
This program is free software; you can redistribute it and/or modify
@ -10,7 +10,7 @@
*/
/**
Wireless M-Bus (EN 13757-4).
Implements the Physical layer (RF receiver) and Data Link layer of the
Wireless M-Bus protocol. Will return a data string (including the CI byte)
for further processing by an Application layer (outside this program).
@ -23,12 +23,14 @@ for further processing by an Application layer (outside this program).
#define BLOCK1_2B_SIZE 128
// Convert two BCD encoded nibbles to an integer
static unsigned bcd2int(uint8_t bcd) {
static unsigned bcd2int(uint8_t bcd)
{
return 10*(bcd>>4) + (bcd & 0xF);
}
// Mapping from 6 bits to 4 bits. "3of6" coding used for Mode T
static uint8_t m_bus_decode_3of6(uint8_t byte) {
static uint8_t m_bus_decode_3of6(uint8_t byte)
{
uint8_t out = 0xFF; // Error
//fprintf(stderr,"Decode %0d\n", byte);
switch(byte) {
@ -56,7 +58,8 @@ static uint8_t m_bus_decode_3of6(uint8_t byte) {
// Decode input 6 bit nibbles to output 4 bit nibbles (packed in bytes). "3of6" coding used for Mode T
// Bad data must be handled with second layer CRC
static int m_bus_decode_3of6_buffer(const bitrow_t bits, unsigned bit_offset, uint8_t* output, unsigned num_bytes) {
static int m_bus_decode_3of6_buffer(const bitrow_t bits, unsigned bit_offset, uint8_t* output, unsigned num_bytes)
{
for (unsigned n=0; n<num_bytes; ++n) {
uint8_t nibble_h = m_bus_decode_3of6(bitrow_get_byte(bits, n*12+bit_offset) >> 2);
uint8_t nibble_l = m_bus_decode_3of6(bitrow_get_byte(bits, n*12+bit_offset+6) >> 2);
@ -83,7 +86,8 @@ static int m_bus_crc_valid(r_device *decoder, const uint8_t *bytes, unsigned crc
// Decode two bytes into three letters of five bits
static void m_bus_manuf_decode(uint16_t m_field, char* three_letter_code) {
static void m_bus_manuf_decode(uint16_t m_field, char* three_letter_code)
{
three_letter_code[0] = (m_field >> 10 & 0x1F) + 0x40;
three_letter_code[1] = (m_field >> 5 & 0x1F) + 0x40;
three_letter_code[2] = (m_field & 0x1F) + 0x40;
@ -92,7 +96,8 @@ static void m_bus_manuf_decode(uint16_t m_field, char* three_letter_code) {
// Decode device type string
const char* m_bus_device_type_str(uint8_t devType) {
const char* m_bus_device_type_str(uint8_t devType)
{
char *str = "";
switch(devType) {
case 0x00: str = "Other"; break;
@ -205,7 +210,8 @@ static char* oms_hum_el[4][4] = {
{"Error 31","Error 32","Error 33","Error 34",}
};
static int m_bus_decode_records(data_t *data, const uint8_t *b, uint8_t dif_coding, uint8_t vif_linear, uint8_t vif_uam, uint8_t dif_sn, uint8_t dif_ff, uint8_t dif_su) {
static int m_bus_decode_records(data_t *data, const uint8_t *b, uint8_t dif_coding, uint8_t vif_linear, uint8_t vif_uam, uint8_t dif_sn, uint8_t dif_ff, uint8_t dif_su)
{
int ret = consumed_bytes[dif_coding&0x07];
float temp;
int state;
@ -260,7 +266,8 @@ static int m_bus_decode_records(data_t *data, const uint8_t *b, uint8_t dif_codi
return ret;
}
static void parse_payload(data_t *data, const m_bus_block1_t *block1, const m_bus_data_t *out) {
static void parse_payload(data_t *data, const m_bus_block1_t *block1, const m_bus_data_t *out)
{
uint8_t off = block1->block2.pl_offset;
const uint8_t *b = out->data;
uint8_t dif = 0;
@ -339,7 +346,8 @@ static void parse_payload(data_t *data, const m_bus_block1_t *block1, const m_bu
return;
}
static int parse_block2(r_device *decoder, const m_bus_data_t *in, m_bus_block1_t *block1) {
static int parse_block2(r_device *decoder, const m_bus_data_t *in, m_bus_block1_t *block1)
{
m_bus_block2_t *b2 = &block1->block2;
const uint8_t *b = in->data+BLOCK1A_SIZE;
@ -517,7 +525,8 @@ static void m_bus_output_data(r_device *decoder, const m_bus_data_t *out, const
}
static int m_bus_mode_c_t_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int m_bus_mode_c_t_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
static const uint8_t PREAMBLE_T[] = {0x54, 0x3D}; // Mode T Preamble (always format A - 3of6 encoded)
// static const uint8_t PREAMBLE_CA[] = {0x55, 0x54, 0x3D, 0x54, 0xCD}; // Mode C, format A Preamble
// static const uint8_t PREAMBLE_CB[] = {0x55, 0x54, 0x3D, 0x54, 0x3D}; // Mode C, format B Preamble
@ -598,7 +607,8 @@ static int m_bus_mode_c_t_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
}
static int m_bus_mode_r_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int m_bus_mode_r_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
static const uint8_t PREAMBLE_RA[] = {0x55, 0x54, 0x76, 0x96}; // Mode R, format A (B not supported)
m_bus_data_t data_in = {0}; // Data from Physical layer decoded to bytes
@ -630,7 +640,8 @@ static int m_bus_mode_r_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
}
// Untested code, signal samples missing
static int m_bus_mode_f_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int m_bus_mode_f_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
static const uint8_t PREAMBLE_F[] = {0x55, 0xF6}; // Mode F Preamble
// static const uint8_t PREAMBLE_FA[] = {0x55, 0xF6, 0x8D}; // Mode F, format A Preamble
// static const uint8_t PREAMBLE_FB[] = {0x55, 0xF6, 0x72}; // Mode F, format B Preamble
@ -678,7 +689,8 @@ static int m_bus_mode_f_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
return 1;
}
static int m_bus_mode_s_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int m_bus_mode_s_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
static const uint8_t PREAMBLE_S[] = {0x54, 0x76, 0x96}; // Mode S Preamble
unsigned int start_pos;
bitbuffer_t packet_bits = {0};
@ -723,7 +735,7 @@ static char *output_fields[] = {
"tpci",
"apci",
"crc",
NULL
NULL,
};
// Mode C1, C2 (Meter TX), T1, T2 (Meter TX),

View file

@ -43,7 +43,8 @@ Layout appears to be:
#include "decoder.h"
static int maverick_et73_sensor_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int maverick_et73_sensor_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
int temp1_raw, temp2_raw, row;
float temp1_c, temp2_c;
uint8_t *bytes;

View file

@ -1,6 +1,5 @@
/** @file
Mebus 433.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -10,7 +9,8 @@
#include "decoder.h"
static int mebus433_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int mebus433_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
bitrow_t *bb = bitbuffer->bb;
int16_t temp;
int8_t hum;
@ -70,7 +70,7 @@ static char *output_fields[] = {
"unknown2",
"temperature_C",
"humidity",
NULL
NULL,
};
r_device mebus433 = {
@ -82,5 +82,5 @@ r_device mebus433 = {
.reset_limit = 6000,
.decode_fn = &mebus433_callback,
.disabled = 1, // add docs, tests, false positive checks and then reenable
.fields = output_fields
.fields = output_fields,
};

View file

@ -19,7 +19,8 @@ start pulse: 1T high, 10.44T low
#include "decoder.h"
static int newkaku_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int newkaku_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
bitrow_t *bb = bitbuffer->bb;

View file

@ -25,7 +25,8 @@ since the Nexa uses two different bit lengths for ON and OFF.
#include "decoder.h"
static int nexa_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int nexa_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
/* Reject missing sync */

View file

@ -104,7 +104,8 @@ static int oil_standard_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsign
Oil tank monitor using manchester encoded FSK/ASK protocol.
@sa oil_standard_decode()
*/
static int oil_standard_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int oil_standard_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
unsigned bitpos = 0;
int events = 0;
@ -131,7 +132,7 @@ static char *output_fields[] = {
"alarm",
"binding_countdown",
"depth_cm",
NULL
NULL,
};
r_device oil_standard = {

View file

@ -25,7 +25,7 @@ SM: soil moisure (decimal 05 -> 99 %)
TT: temperature °C + 40°C (decimal)
??: always FF... maybe spare bytes
CC: check sum (simple sum) except 0xFF preamble
*/
#include "decoder.h"
@ -99,7 +99,7 @@ static char *output_fields[] = {
"channel",
"temperature_C",
"moisture",
NULL
NULL,
};
@ -112,5 +112,5 @@ r_device opus_xt300 = {
.reset_limit = 31000,
.decode_fn = &opus_xt300_callback,
.disabled = 0,
.fields = output_fields
.fields = output_fields,
};

View file

@ -55,8 +55,8 @@ static int oregon_scientific_sl109h_callback(r_device *decoder, bitbuffer_t *bit
bitbuffer_extract_bytes(bitbuffer, row_index, 2, b, 36);
b[0] &= 0x3f;
// Prevent false positives from 'allzero'
// reject if Checksum channelhumidity and temperature are all zero
// Prevent false positives from 'allzero'
// reject if Checksum channelhumidity and temperature are all zero
// No need to decode/extract values for simple test
if (chk == 0 && b[0] == 0 && b[1] == 0 && b[2] == 0)
continue; // DECODE_FAIL_SANITY

View file

@ -24,7 +24,8 @@ beginning with a 0 will have data in this gap.
#define OSV1_BITS 32
static int oregon_scientific_v1_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int oregon_scientific_v1_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
int ret = 0;
int row;
int cs;
@ -99,7 +100,7 @@ static char *output_fields[] = {
"channel",
"battery",
"temperature_C",
NULL
NULL,
};
r_device oregon_scientific_v1 = {
@ -111,5 +112,5 @@ r_device oregon_scientific_v1 = {
.reset_limit = 14000,
.decode_fn = &oregon_scientific_v1_callback,
.disabled = 0,
.fields = output_fields
.fields = output_fields,
};

View file

@ -47,7 +47,8 @@ Packet gap is 10 ms.
#include "decoder.h"
static int proove_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int proove_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
/* Reject missing sync */

View file

@ -1,6 +1,6 @@
/** @file
Quhwa HS1527.
Copyright (C) 2016 Ask Jakobsen
This program is free software; you can redistribute it and/or modify
@ -60,7 +60,7 @@ static int quhwa_callback(r_device *decoder, bitbuffer_t *bitbuffer)
static char *output_fields[] = {
"model",
"id",
NULL
NULL,
};
r_device quhwa = {
@ -74,5 +74,5 @@ r_device quhwa = {
.tolerance = 80, // us
.decode_fn = &quhwa_callback,
.disabled = 0,
.fields = output_fields
.fields = output_fields,
};

View file

@ -32,7 +32,8 @@ The sensor can be bought at Kjell&Co
#include "decoder.h"
// NOTE: this is used in nexus.c and solight_te44.c
int rubicson_crc_check(uint8_t *b) {
int rubicson_crc_check(uint8_t *b)
{
uint8_t tmp[5];
tmp[0] = b[0]; // Byte 0 is nibble 0 and 1
tmp[1] = b[1]; // Byte 1 is nibble 2 and 3
@ -44,7 +45,8 @@ int rubicson_crc_check(uint8_t *b) {
return crc8(tmp, 5, 0x31, 0x6c) == 0;
}
static int rubicson_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int rubicson_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b;
int id, battery, channel, temp_raw;

View file

@ -57,7 +57,8 @@ Random Code / Device ID: (Nibble 1)
#include "decoder.h"
static int s3318p_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int s3318p_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
uint8_t b[5];
data_t *data;

View file

@ -32,7 +32,8 @@ Packet payload: 1 sync nibble and 8 bytes data, 17 nibbles:
#include "decoder.h"
static int schraeder_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int schraeder_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t b[8];
int serial_id;
@ -93,7 +94,8 @@ Probable packet payload:
- T: temperature, degrees Fahrenheit
- C: checksum, sum of byte data modulo 256
*/
static int schrader_EG53MA4_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int schrader_EG53MA4_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t b[10];
int serial_id;

View file

@ -49,7 +49,7 @@ static int scmplus_callback(r_device *decoder, bitbuffer_t *bitbuffer)
if (decoder->verbose) {
fprintf(stderr, "%s: row len=%hu\n", __func__, bitbuffer->bits_per_row[0]);
fprintf(stderr, "%s: sync_index=%d\n", __func__, sync_index);
fprintf(stderr, "%s: sync_index=%u\n", __func__, sync_index);
}
// bitbuffer_debug(bitbuffer);
@ -150,8 +150,8 @@ static int scmplus_callback(r_device *decoder, bitbuffer_t *bitbuffer)
// fprintf(stderr, "meter_type = %s\n", meter_type);
/*
Field key names and format set to match rtlamr field names
/*
Field key names and format set to match rtlamr field names
{Time:2020-06-20T09:58:19.074 Offset:49152 Length:49152
SCM+:{ProtocolID:0x1E EndpointType:0xAB EndpointID: 68211547 Consumption: 6883 Tamper:0x4900 PacketCRC:0x39BE}}

View file

@ -1,5 +1,5 @@
/** @file
Security+ 2.0 rolling code
Security+ 2.0 rolling code.
Copyright (C) 2020 Peter Shipley <peter.shipley@gmail.com>
Based on code by Clayton Smith https://github.com/argilo/secplus
@ -21,24 +21,22 @@ Security+ 2.0 is described in [US patent application US20110317835A1](https://p
#include "decoder.h"
/**
Security+ 2.0 rolling code.
data comes in two bursts/packets
Data comes in two bursts/packets.
Layout:
bits = `AA BB IIII OOOO X*30`
bits = `AA BB IIII OOOO X*30`
AA = payload type ( 2 bits 00 or 01 )
BB = FrameID ( 2 bits always 00)
IIII = inversion indicator ( 4 bits )
OOOO = Order indicator ( 4 bits ).
XXXX.... = data ( 30 bits )
- AA = payload type ( 2 bits 00 or 01 )
- BB = FrameID ( 2 bits always 00)
- IIII = inversion indicator ( 4 bits )
- OOOO = Order indicator ( 4 bits ).
- XXXX.... = data ( 30 bits )
---
data is broken up into 3 parts ( p0 p1 p2 )
eg:
@ -68,10 +66,8 @@ Once the above has been run twice the two are merged
---
*/
int _decode_v2_half(bitbuffer_t *bits, uint8_t roll_array[], bitbuffer_t *fixed_p, int verbose)
{
uint8_t invert = 0;
@ -113,7 +109,7 @@ int _decode_v2_half(bitbuffer_t *bits, uint8_t roll_array[], bitbuffer_t *fixed_
// using short to store 10bit values
uint16_t p0 = 0, p1 = 0, p2 = 0;
// sort 30 bits of interleaved data into three 10 bit buffers
// sort 30 bits of interleaved data into three 10 bit buffers
for (int i = 0; i < 10; i++) {
p2 ^= (x & 0x00000001) << i; // 9-
x >>= 1;
@ -157,7 +153,7 @@ int _decode_v2_half(bitbuffer_t *bits, uint8_t roll_array[], bitbuffer_t *fixed_
case 0x09: // 0b1001 (False, False, False),
break;
default:
if (verbose)
if (verbose)
fprintf(stderr, "Invert FAIL\n");
return 1;
}
@ -220,7 +216,7 @@ int _decode_v2_half(bitbuffer_t *bits, uint8_t roll_array[], bitbuffer_t *fixed_
// bitrow_printf(buffy, 8, "%s ; buffy bits ", __func__);
// assemble binary bits into trinary
// assemble binary bits into trinary
x = p2;
for (int i = 8; i >= 0; i -= 2) {
roll_array[k++] = (x >> i) & 0x03;
@ -234,7 +230,7 @@ int _decode_v2_half(bitbuffer_t *bits, uint8_t roll_array[], bitbuffer_t *fixed_
fprintf(stderr, "\n");
}
// SANITY check trinary valuse, 00/01/10 are valid, 11 is not
// SANITY check trinary valuse, 00/01/10 are valid, 11 is not
for (int i = 0; i < 9; i++) {
if (roll_array[i] == 3) {
fprintf(stderr, "roll_array val FAIL\n");
@ -308,7 +304,7 @@ static int secplus_v2_callback(r_device *decoder, bitbuffer_t *bitbuffer)
continue;
}
// 2nd bit indicates with half of the data
// 2nd bit indicates with half of the data
if (bits.bb[0][0] & 0xC0) {
if (decoder->verbose)
(void)fprintf(stderr, "%s: Set 2\n", __func__);
@ -417,7 +413,6 @@ static int secplus_v2_callback(r_device *decoder, bitbuffer_t *bitbuffer)
}
static char *output_fields[] = {
// Common fields
"model",
"rolling"

View file

@ -43,7 +43,7 @@ This means the primary will always have the same unit number as the
last learned secondary, weird.
Also you always need to learn from the same primary.
*/
*/
#include "decoder.h"
@ -121,7 +121,7 @@ static char *output_fields[] = {
"unit",
"learn",
"code",
NULL
NULL,
};
r_device smoke_gs558 = {
@ -133,5 +133,5 @@ r_device smoke_gs558 = {
.reset_limit = 11764 * 1.2f, // Maximum gap size before End Of Message [us]
.decode_fn = &smoke_gs558_callback,
.disabled = 0,
.fields = output_fields
.fields = output_fields,
};

View file

@ -45,7 +45,7 @@ static int tpms_jansite_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsign
if (packet_bits.bits_per_row[0] < 56) {
return DECODE_FAIL_SANITY;
// fprintf(stderr, "%s packet_bits.bits_per_row = %d\n", __func__, packet_bits.bits_per_row[0]);
// fprintf(stderr, "%s packet_bits.bits_per_row = %d\n", __func__, packet_bits.bits_per_row[0]);
}
b = packet_bits.bb[0];

View file

@ -79,7 +79,8 @@ static int tpms_renault_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsign
}
/** @sa tpms_renault_decode() */
static int tpms_renault_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int tpms_renault_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
// full preamble is 55 55 55 56 (inverted: aa aa aa a9)
uint8_t const preamble_pattern[2] = {0xaa, 0xa9}; // 16 bits

View file

@ -57,7 +57,8 @@ Based on code provided by Willi 'wherzig' in issue #30 (2014-04-21)
#include "decoder.h"
static int x10_sec_callback(r_device *decoder, bitbuffer_t *bitbuffer) {
static int x10_sec_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b; /* bits of a row */
char *event_str = "UNKNOWN"; /* human-readable event */