From 50dc96507caba9480938eb3d9d0db9236f877b49 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 26 Dec 2014 01:41:41 +0100 Subject: 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. --- src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_nl.c index 4bbc7193..f41bec23 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); -- cgit v1.2.3