aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-26 01:41:41 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-26 01:46:24 +0100
commit50dc96507caba9480938eb3d9d0db9236f877b49 (patch)
tree49ebcbb55b8199759959558b7171cd38ea8a2bce
parentc265bef48c414ca6c135f803c0c5dfdecbeece72 (diff)
sysmobts: Include the serial number in the find response
Read the serial number once and format it as a string. In case no serial number is present -1 will be returned. Manually tested with a slightly modified version. serial_nr was the expected one.
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c
index 4bbc719..f41bec2 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c
@@ -80,8 +80,9 @@ static void respond_to(struct sockaddr_in *src, struct osmo_fd *fd,
uint8_t *data, size_t len)
{
static int fetched_info = 0;
- static char mac_str[20] = { };
+ static char mac_str[20] = {0, };
static char *model_name;
+ static char ser_str[20] = {0, };
struct sockaddr_in loc_addr;
int rc;
@@ -94,6 +95,7 @@ static void respond_to(struct sockaddr_in *src, struct osmo_fd *fd,
if (!fetched_info) {
uint8_t mac[6];
+ int serno;
/* fetch the MAC */
sysmobts_par_get_buf(SYSMOBTS_PAR_MAC, mac, sizeof(mac));
@@ -101,6 +103,10 @@ static void respond_to(struct sockaddr_in *src, struct osmo_fd *fd,
mac[0], mac[1], mac[2],
mac[3], mac[4], mac[5]);
+ /* fetch the serial number */
+ sysmobts_par_get_int(SYSMOBTS_PAR_SERNR, &serno);
+ snprintf(ser_str, sizeof(ser_str), "%d", serno);
+
/* fetch the model and trx number */
switch(sysmobts_bts_type()) {
case 0:
@@ -139,6 +145,9 @@ static void respond_to(struct sockaddr_in *src, struct osmo_fd *fd,
inet_ntop(AF_INET, &loc_addr.sin_addr, loc_ip, sizeof(loc_ip));
quirk_l16tv_put(msg, strlen(loc_ip) + 1, IPAC_IDTAG_IPADDR, (uint8_t *) loc_ip);
+ /* append the serial number */
+ quirk_l16tv_put(msg, strlen(ser_str) + 1, IPAC_IDTAG_SERNR, (uint8_t *) ser_str);
+
/* abuse some flags */
quirk_l16tv_put(msg, strlen(model_name) + 1, IPAC_IDTAG_UNIT, (uint8_t *) model_name);