Skip to content

Commit

Permalink
fix: make r_device.fields a constant pointer allows for static "outpu…
Browse files Browse the repository at this point in the history
…t_fields" to be stored in readonly memory on embedded architectures
  • Loading branch information
obones committed Mar 13, 2023
1 parent 2a9ce36 commit 9798712
Show file tree
Hide file tree
Showing 217 changed files with 240 additions and 235 deletions.
2 changes: 1 addition & 1 deletion include/r_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ typedef struct r_device {
struct r_device *(*create_fn)(char *args);
unsigned priority; ///< Run later and only if no previous events were produced
unsigned disabled; ///< 0: default enabled, 1: default disabled, 2: disabled, 3: disabled and hidden
char const **fields; ///< List of fields this decoder produces; required for CSV output. NULL-terminated.
char const *const *fields; ///< List of fields this decoder produces; required for CSV output. NULL-terminated.

/* public for each decoder */
int verbose;
Expand Down
2 changes: 1 addition & 1 deletion src/devices/abmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static int abmt_callback(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"temperature_C",
Expand Down
16 changes: 8 additions & 8 deletions src/devices/acurite.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int const acurite_5n1_winddirections[] = {
// 11 = A
static char const *acurite_getChannel(uint8_t byte)
{
static char const *channel_strs[] = {"C", "E", "B", "A"}; // 'E' stands for error
static char const *const channel_strs[] = {"C", "E", "B", "A"}; // 'E' stands for error

int channel = (byte & 0xC0) >> 6;
return channel_strs[channel];
Expand Down Expand Up @@ -1861,7 +1861,7 @@ static int acurite_00275rm_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return result;
}

static char const *acurite_rain_gauge_output_fields[] = {
static char const *const acurite_rain_gauge_output_fields[] = {
"model",
"id",
"rain_mm",
Expand All @@ -1880,7 +1880,7 @@ r_device const acurite_rain_896 = {
.fields = acurite_rain_gauge_output_fields,
};

static char const *acurite_th_output_fields[] = {
static char const *const acurite_th_output_fields[] = {
"model",
"id",
"battery_ok",
Expand All @@ -1906,7 +1906,7 @@ r_device const acurite_th = {
* For Acurite 592 TXR Temp/Humidity, but
* Should match Acurite 592TX, 5-n-1, etc.
*/
static char const *acurite_txr_output_fields[] = {
static char const *const acurite_txr_output_fields[] = {
"model",
"message_type", // TODO: remove this
"id",
Expand Down Expand Up @@ -1957,7 +1957,7 @@ r_device const acurite_txr = {
* A transmission consists of two packets that run into each other.
* There should be 40 bits of data though. But the last bit can't be detected.
*/
static char const *acurite_986_output_fields[] = {
static char const *const acurite_986_output_fields[] = {
"model",
"id",
"channel",
Expand Down Expand Up @@ -1986,7 +1986,7 @@ r_device const acurite_986 = {
*
*/

static char const *acurite_606_output_fields[] = {
static char const *const acurite_606_output_fields[] = {
"model",
"id",
"battery_ok",
Expand All @@ -1995,7 +1995,7 @@ static char const *acurite_606_output_fields[] = {
NULL,
};

static char const *acurite_590_output_fields[] = {
static char const *const acurite_590_output_fields[] = {
"model",
"id",
"battery_ok",
Expand Down Expand Up @@ -2023,7 +2023,7 @@ r_device const acurite_606 = {
.fields = acurite_606_output_fields,
};

static char const *acurite_00275rm_output_fields[] = {
static char const *const acurite_00275rm_output_fields[] = {
"model",
"subtype",
"id",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/acurite_01185m.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static int acurite_01185m_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return result;
}

static char const *acurite_01185m_output_fields[] = {
static char const *const acurite_01185m_output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/akhan_100F14.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static int akhan_rke_callback(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"data",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/alecto.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ static int alectov1_callback(r_device *decoder, bitbuffer_t *bitbuffer)
return DECODE_FAIL_SANITY;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/ambient_weather.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static int ambient_weather_callback(r_device *decoder, bitbuffer_t *bitbuffer)
return ret;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/ambientweather_tx8300.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static int ambientweather_tx8300_callback(r_device *decoder, bitbuffer_t *bitbuf
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/ambientweather_wh31e.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ static int ambientweather_whx_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return events;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/ant_antplus.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static int ant_antplus_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"network",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/archos_tbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static int archos_tbh_decode(r_device *decoder, bitbuffer_t *bitbuffer)
}
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"battery_ok",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/atech_ws308.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static int atech_ws308_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"temperature_C",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/auriol_4ld5661.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static int auriol_4ld5661_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return ret;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"battery_ok",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/auriol_aft77b2.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static int auriol_aft77_b2_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"temperature_C",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/auriol_afw2a1.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static int auriol_afw2a1_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/auriol_ahfl.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static int auriol_ahfl_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/auriol_hg02832.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static int auriol_hg02832_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/badger_water.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static int badger_orion_decode(r_device *decoder, bitbuffer_t *bitbuffer)
}

// Note: At this time the exact meaning of the flags is not known.
static char const *badger_output_fields[] = {
static char const *const badger_output_fields[] = {
"model",
"id",
"flags_1",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/baldr_rain.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static int baldr_rain_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"flags",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/blueline.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ static int blueline_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return ((payloads_decoded > 0) ? payloads_decoded : most_applicable_failure);
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"flags",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/blyss.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static int blyss_callback(r_device *decoder, bitbuffer_t *bitbuffer)
return DECODE_FAIL_SANITY;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
NULL,
Expand Down
2 changes: 1 addition & 1 deletion src/devices/brennenstuhl_rcs_2044.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static int brennenstuhl_rcs_2044_callback(r_device *decoder, bitbuffer_t *bitbuf
return counter;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"key",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/bresser_3ch.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static int bresser_3ch_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/bresser_5in1.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static int bresser_5in1_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"battery_ok",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/bresser_6in1.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static int bresser_6in1_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/bresser_7in1.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static int bresser_7in1_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"temperature_C",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/bt_rain.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int bt_rain_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/burnhardbbq.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static int burnhardbbq_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return ret;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"channel",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/calibeur.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static int calibeur_rf104_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"temperature_C",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/cardin.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static int cardin_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"dipswitch",
"rbutton",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/cavius.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static int cavius_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"battery_ok",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/ced7000.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static int ced7000_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"count",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/celsia_czc1.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static int celsia_czc1_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"heat",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/chuango.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static int chuango_callback(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"id",
"cmd",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/cmr113.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static int cmr113_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"current_1_A",
"current_2_A",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/companion_wtr001.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static int companion_wtr001_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *output_fields[] = {
static char const *const output_fields[] = {
"model",
"temperature_C",
"mic",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/cotech_36_7959.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static int cotech_36_7959_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return 1;
}

static char const *cotech_36_7959_output_fields[] = {
static char const *const cotech_36_7959_output_fields[] = {
"model",
//"subtype",
"id",
Expand Down
Loading

0 comments on commit 9798712

Please sign in to comment.