FreeCalypso > hg > freecalypso-tools
view rvinterf/etmsync/rfcap.c @ 964:a96cb97b66a2
ringtools/imy: fix duplicate definition of tdma_durations[]
The bug was reported by Vadim Yanitskiy <fixeria@osmocom.org>,
although the present fix is slightly different from the contributed
patch: because main.c doesn't need this tdma_durations[] array
at all, let's simply remove the reference to this array from main.c
rather than turn it into an extern.
I no longer remember my original thought flow that resulted (by mistake)
in tdma_durations[] being multiply defined in main.c and durations.c.
My intent might have been to define all globals in main.c and have
the reference in durations.c be an extern - and I missed that extern -
but without clear memory, I have no certainty. In any case, having
this data array defined in the same module that fills it (durations.c)
is sensible, so let's make it the new way.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 31 Aug 2023 19:38:18 +0000 |
parents | e7502631a0f9 |
children |
line wrap: on
line source
/* * Setting of /gsm/com/rfcap */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "exitcodes.h" static struct band_table { char *keyword; u_char bytes[4]; } band_table[] = { {"dual-eu", {0x00, 0x0B, 0x41, 0x00}}, {"dual-us", {0x00, 0x14, 0x00, 0x14}}, {"tri900", {0x00, 0x0F, 0x41, 0x10}}, {"tri850", {0x00, 0x16, 0x01, 0x14}}, {"quad", {0x00, 0x1F, 0x41, 0x14}}, {0, {0x00, 0x00, 0x00, 0x00}} }; static u_char rfcap_tail[12] = {0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0xA5, 0x05, 0x00, 0xC0, 0x00}; set_rfcap(band_config_kw) char *band_config_kw; { static char filename[] = "/gsm/com/rfcap"; u_char bytes[16]; struct band_table *tp; for (tp = band_table; tp->keyword; tp++) if (!strcmp(tp->keyword, band_config_kw)) break; if (!tp->keyword) { printf("error: band configuration \"%s\" not known\n", band_config_kw); return(ERROR_USAGE); } bcopy(tp->bytes, bytes, 4); bcopy(rfcap_tail, bytes + 4, 12); printf("Writing \"%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\" into %s\n", bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15], filename); return do_short_fwrite(filename, bytes, 16); }