Change in osmo-trx[master]: lms: Store device type specific parameters in one place

2020-01-16 Thread pespin
pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/16876 )

Change subject: lms: Store device type specific parameters in one place
..

lms: Store device type specific parameters in one place

Add an enum containing each supported device type (LimeSDR-USB,
LimeSDR-Mini and LimeNet-Micro) plus "unknown", to leave some room for
yet-to-come devices to run with some generic parameters without
rebuilding osmo-trx.

Each device type is assigned a dev_desc structure, and all of them are
put in HashMap, similar to what's already done in UHDDevice.cpp.

Device type is infered from string provided by LMS_GetDeviceInfo(), as
it was already done before in several places. From now on, we only need
to parse the string once since we store the device type after first
during open time.

Later on, more fields will be moved to device-type specific structure,
such as Tx timing offset, clock rate, etc.

Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
---
M CommonLibs/trx_vty.c
M CommonLibs/trx_vty.h
M Transceiver52M/device/lms/LMSDevice.cpp
M Transceiver52M/device/lms/LMSDevice.h
4 files changed, 119 insertions(+), 26 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  fixeria: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/CommonLibs/trx_vty.c b/CommonLibs/trx_vty.c
index 44e1d31..3f875f5 100644
--- a/CommonLibs/trx_vty.c
+++ b/CommonLibs/trx_vty.c
@@ -42,7 +42,7 @@

 static struct trx_ctx* g_trx_ctx;

-static const struct value_string clock_ref_names[] = {
+const struct value_string clock_ref_names[] = {
{ REF_INTERNAL, "internal" },
{ REF_EXTERNAL, "external" },
{ REF_GPS,  "gpsdo" },
diff --git a/CommonLibs/trx_vty.h b/CommonLibs/trx_vty.h
index d20dd96..c0d54cf 100644
--- a/CommonLibs/trx_vty.h
+++ b/CommonLibs/trx_vty.h
@@ -5,6 +5,7 @@
 #include "config_defs.h"

 extern struct vty_app_info g_vty_info;
+extern const struct value_string clock_ref_names[];
 extern const struct value_string filler_names[];

 /* Maximum number of physical RF channels */
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp 
b/Transceiver52M/device/lms/LMSDevice.cpp
index 8ad338b..1ef7728 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -20,6 +20,10 @@
 #include 
 #include 
 #include 
+
+#include 
+
+#include "trx_vty.h"
 #include "Logger.h"
 #include "Threads.h"
 #include "LMSDevice.h"
@@ -44,11 +48,61 @@
 #define LMS_CALIBRATE_BW_HZ OSMO_MAX(GSM_CARRIER_BW, LMS_MIN_BW_SUPPORTED)
 #define SAMPLE_BUF_SZ(1 << 20) /* Size of Rx timestamp based Ring buffer, 
in bytes */

+
+/* Device Name Prefixes as presented by LimeSuite API LMS_GetDeviceInfo(): */
+#define LMS_DEV_SDR_USB_PREFIX_NAME "LimeSDR-USB"
+#define LMS_DEV_SDR_MINI_PREFIX_NAME "LimeSDR-Mini"
+#define LMS_DEV_NET_MICRO_PREFIX_NAME "LimeNET-Micro"
+
+/* Device parameter descriptor */
+struct dev_desc {
+   /* Does LimeSuite allow switching the clock source for this device?
+* LimeSDR-Mini does not have switches but needs soldering to select
+* external/internal clock. Any call to LMS_SetClockFreq() will fail.
+*/
+   bool clock_src_switchable;
+   /* Does LimeSuite allow using REF_INTERNAL for this device?
+* LimeNET-Micro does not like selecting internal clock
+*/
+   bool clock_src_int_usable;
+   /* Device specific maximum tx levels selected by phasenoise 
measurements, in dB */
+   double max_tx_gain;
+   /* Device Name Prefix as presented by LimeSuite API LMS_GetDeviceInfo() 
*/
+   std::string name_prefix;
+};
+
+static const std::map dev_param_map {
+   { LMS_DEV_SDR_USB,   { true,  true,  73.0, LMS_DEV_SDR_USB_PREFIX_NAME 
} },
+   { LMS_DEV_SDR_MINI,  { false, true,  66.0, LMS_DEV_SDR_MINI_PREFIX_NAME 
} },
+   { LMS_DEV_NET_MICRO, { true,  false, 71.0, 
LMS_DEV_NET_MICRO_PREFIX_NAME } },
+   { LMS_DEV_UNKNOWN,   { true,  true,  73.0, "UNKNOWN" } },
+};
+
+static enum lms_dev_type parse_dev_type(lms_device_t *m_lms_dev)
+{
+   std::map::const_iterator it = 
dev_param_map.begin();
+
+   const lms_dev_info_t* device_info = LMS_GetDeviceInfo(m_lms_dev);
+
+   while (it != dev_param_map.end())
+   {
+   enum lms_dev_type dev_type = it->first;
+   struct dev_desc desc = it->second;
+
+   if (strncmp(device_info->deviceName, desc.name_prefix.c_str(), 
desc.name_prefix.length()) == 0) {
+   LOGC(DDEV, INFO) << "Device identified as " << 
desc.name_prefix;
+   return dev_type;
+   }
+   it++;
+   }
+   return LMS_DEV_UNKNOWN;
+}
+
 LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t 
chan_num, double lo_offset,
 const std::vector& tx_paths

Change in osmo-trx[master]: lms: Store device type specific parameters in one place

2020-01-16 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/16876 )

Change subject: lms: Store device type specific parameters in one place
..


Patch Set 2: Code-Review+2

+1+1=+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/16876
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
Gerrit-Change-Number: 16876
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 16 Jan 2020 13:09:36 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-trx[master]: lms: Store device type specific parameters in one place

2020-01-16 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/16876 )

Change subject: lms: Store device type specific parameters in one place
..


Patch Set 2: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/c/osmo-trx/+/16876/2/Transceiver52M/device/lms/LMSDevice.cpp
File Transceiver52M/device/lms/LMSDevice.cpp:

https://gerrit.osmocom.org/c/osmo-trx/+/16876/2/Transceiver52M/device/lms/LMSDevice.cpp@a215
PS2, Line 215: maxTxGainClamp = 73.0;
> Which old code? I don't understand. Its use is dropped in: […]
Oops, I see now. Sorry.



--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/16876
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
Gerrit-Change-Number: 16876
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 16 Jan 2020 12:33:03 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: pespin 
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


Change in osmo-trx[master]: lms: Store device type specific parameters in one place

2020-01-16 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/16876 )

Change subject: lms: Store device type specific parameters in one place
..


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/c/osmo-trx/+/16876/2/Transceiver52M/device/lms/LMSDevice.cpp
File Transceiver52M/device/lms/LMSDevice.cpp:

https://gerrit.osmocom.org/c/osmo-trx/+/16876/2/Transceiver52M/device/lms/LMSDevice.cpp@a215
PS2, Line 215: maxTxGainClamp = 73.0;
> So you move this parameter to dev_param_map, but the old code may still be 
> using maxTxGainClamp. […]
Which old code? I don't understand. Its use is dropped in:
double LMSDevice::maxTxGain()
{
return dev_param_map.at(m_dev_type).max_tx_gain;
}

see line 386.



--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/16876
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
Gerrit-Change-Number: 16876
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 16 Jan 2020 12:03:31 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


Change in osmo-trx[master]: lms: Store device type specific parameters in one place

2020-01-16 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/16876 )

Change subject: lms: Store device type specific parameters in one place
..


Patch Set 2: Code-Review-1

(2 comments)

CR-1 because of maxTxGainClamp.

https://gerrit.osmocom.org/c/osmo-trx/+/16876/2/Transceiver52M/device/lms/LMSDevice.cpp
File Transceiver52M/device/lms/LMSDevice.cpp:

https://gerrit.osmocom.org/c/osmo-trx/+/16876/2/Transceiver52M/device/lms/LMSDevice.cpp@a215
PS2, Line 215: maxTxGainClamp = 73.0;
So you move this parameter to dev_param_map, but the old code may still be 
using maxTxGainClamp. Am I missing something?


https://gerrit.osmocom.org/c/osmo-trx/+/16876/2/Transceiver52M/device/lms/LMSDevice.cpp@417
PS2, Line 417: if (dev_desc.clock_src_switchable)
I would move this check before the switch and return early if 
!dev_desc.clock_src_switchable.



--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/16876
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
Gerrit-Change-Number: 16876
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 16 Jan 2020 09:21:54 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-trx[master]: lms: Store device type specific parameters in one place

2020-01-15 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/16876 )

Change subject: lms: Store device type specific parameters in one place
..


Patch Set 2: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/16876
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
Gerrit-Change-Number: 16876
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Wed, 15 Jan 2020 14:54:10 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-trx[master]: lms: Store device type specific parameters in one place

2020-01-15 Thread pespin
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-trx/+/16876

to look at the new patch set (#2).

Change subject: lms: Store device type specific parameters in one place
..

lms: Store device type specific parameters in one place

Add an enum containing each supported device type (LimeSDR-USB,
LimeSDR-Mini and LimeNet-Micro) plus "unknown", to leave some room for
yet-to-come devices to run with some generic parameters without
rebuilding osmo-trx.

Each device type is assigned a dev_desc structure, and all of them are
put in HashMap, similar to what's already done in UHDDevice.cpp.

Device type is infered from string provided by LMS_GetDeviceInfo(), as
it was already done before in several places. From now on, we only need
to parse the string once since we store the device type after first
during open time.

Later on, more fields will be moved to device-type specific structure,
such as Tx timing offset, clock rate, etc.

Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
---
M CommonLibs/trx_vty.c
M CommonLibs/trx_vty.h
M Transceiver52M/device/lms/LMSDevice.cpp
M Transceiver52M/device/lms/LMSDevice.h
4 files changed, 119 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/76/16876/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/16876
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
Gerrit-Change-Number: 16876
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: fixeria 
Gerrit-MessageType: newpatchset


Change in osmo-trx[master]: lms: Store device type specific parameters in one place

2020-01-15 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/16876 )

Change subject: lms: Store device type specific parameters in one place
..


Patch Set 1:

(5 comments)

https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.h
File Transceiver52M/device/lms/LMSDevice.h:

https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.h@48
PS1, Line 48: LMS_DEV_UNKNOWN
> Maybe rather keep this one first, so it will be 0?
I prefer keeping it at the end since it's the "leftover" one, taken if no other 
is matched. There's not need for it to be 0.


https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.h@70
PS1, Line 70: dev_type
> ... […]
We have c++ constructors for that.


https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.cpp
File Transceiver52M/device/lms/LMSDevice.cpp:

https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.cpp@51
PS1, Line 51: Device Name Prefixes
> How about using value_string array here?
The value_string similar stuff is already in std::map dev_param_map, in here 
I'm just listing them in defines to be used later to make sure other people 
don't start using their own prefix name strings in other places.


https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.cpp@245
PS1, Line 245: /* FIXME make external reference frequency configurable */
> should we still keep this comment? As far as I can see, you're checking if 
> it's supported now...
AFAIU this comment talks about changing the external frequency value, not the 
sample rate source. See 1000.0 is hardcoded.


https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.cpp@275
PS1, Line 275: else
> So if !dev_desc. […]
Makes sense thanks.



--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/16876
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
Gerrit-Change-Number: 16876
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Wed, 15 Jan 2020 12:40:37 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


Change in osmo-trx[master]: lms: Store device type specific parameters in one place

2020-01-14 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/16876 )

Change subject: lms: Store device type specific parameters in one place
..


Patch Set 1:

(6 comments)

https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.h
File Transceiver52M/device/lms/LMSDevice.h:

https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.h@48
PS1, Line 48: LMS_DEV_UNKNOWN
Maybe rather keep this one first, so it will be 0?


https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.h@70
PS1, Line 70: dev_type
Also, how about adding prefix 'm_'?


https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.h@70
PS1, Line 70: dev_type
... so unless we explicitly initialize this field, we fall-back to UNKNOWN? 
(see my comment above)


https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.cpp
File Transceiver52M/device/lms/LMSDevice.cpp:

https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.cpp@51
PS1, Line 51: Device Name Prefixes
How about using value_string array here?


https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.cpp@245
PS1, Line 245: /* FIXME make external reference frequency configurable */
should we still keep this comment? As far as I can see, you're checking if it's 
supported now...


https://gerrit.osmocom.org/c/osmo-trx/+/16876/1/Transceiver52M/device/lms/LMSDevice.cpp@275
PS1, Line 275: else
So if !dev_desc.clock_src_switchable, we would print this log message twice? Or 
at least once if it's actually supported. Maybe you need a conditional else 
branch:

  ... } else if (!dev_desc.clock_src_switchable) { ...



--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/16876
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
Gerrit-Change-Number: 16876
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Wed, 15 Jan 2020 02:32:45 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in osmo-trx[master]: lms: Store device type specific parameters in one place

2020-01-14 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/16876 )


Change subject: lms: Store device type specific parameters in one place
..

lms: Store device type specific parameters in one place

Add an enum containing each supported device type (LimeSDR-USB,
LimeSDR-Mini and LimeNet-Micro) plus "unknown", to leave some room for
yet-to-come devices to run with some generic parameters without
rebuilding osmo-trx.

Each device type is assigned a dev_desc structure, and all of them are
put in HashMap, similar to what's already done in UHDDevice.cpp.

Device type is infered from string provided by LMS_GetDeviceInfo(), as
it was already done before in several places. From now on, we only need
to parse the string once since we store the device type after first
during open time.

Later on, more fields will be moved to device-type specific structure,
such as Tx timing offset, clock rate, etc.

Change-Id: I7658615787c5bc41c365bab9c11733b701ac2ae5
---
M Transceiver52M/device/lms/LMSDevice.cpp
M Transceiver52M/device/lms/LMSDevice.h
2 files changed, 89 insertions(+), 22 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/76/16876/1

diff --git a/Transceiver52M/device/lms/LMSDevice.cpp 
b/Transceiver52M/device/lms/LMSDevice.cpp
index a533e7e..2e164ed 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -20,6 +20,9 @@
 #include 
 #include 
 #include 
+
+#include 
+
 #include "Logger.h"
 #include "Threads.h"
 #include "LMSDevice.h"
@@ -44,11 +47,62 @@
 #define LMS_CALIBRATE_BW_HZ OSMO_MAX(GSM_CARRIER_BW, LMS_MIN_BW_SUPPORTED)
 #define SAMPLE_BUF_SZ(1 << 20) /* Size of Rx timestamp based Ring buffer, 
in bytes */

+
+/* Device Name Prefixes as presented by LimeSuite API LMS_GetDeviceInfo(): */
+#define LMS_DEV_SDR_USB_PREFIX_NAME "LimeSDR-USB"
+#define LMS_DEV_SDR_MINI_PREFIX_NAME "LimeSDR-Mini"
+#define LMS_DEV_NET_MICRO_PREFIX_NAME "LimeNET-Micro"
+
+/* Device parameter descriptor */
+struct dev_desc {
+   /* Does LimeSuite allow switching the clock source for this device?
+* LimeSDR-Mini does not have switches but needs soldering to select
+* external/internal clock. Any call to LMS_SetClockFreq() will fail.
+*/
+   bool clock_src_switchable;
+   /* Does LimeSuite allow using REF_INTERNAL for this device?
+* LimeNET-Micro does not like selecting internal clock
+*/
+   bool clock_src_int_usable;
+   /* Device specific maximum tx levels selected by phasenoise 
measurements, in dB */
+   double max_tx_gain;
+   /* Device Name Prefix as presented by LimeSuite API LMS_GetDeviceInfo() 
*/
+   std::string name_prefix;
+};
+
+static const std::map dev_param_map {
+   { LMS_DEV_SDR_USB,   { true,  true,  73.0, LMS_DEV_SDR_USB_PREFIX_NAME 
} },
+   { LMS_DEV_SDR_MINI,  { false, true,  66.0, LMS_DEV_SDR_MINI_PREFIX_NAME 
} },
+   { LMS_DEV_NET_MICRO, { true,  false, 71.0, 
LMS_DEV_NET_MICRO_PREFIX_NAME } },
+   { LMS_DEV_UNKNOWN,   { true,  true,  73.0, "UNKNOWN" } },
+};
+
+static enum lms_dev_type parse_dev_type(lms_device_t *m_lms_dev)
+{
+   std::map::const_iterator it = 
dev_param_map.begin();
+
+   const lms_dev_info_t* device_info = LMS_GetDeviceInfo(m_lms_dev);
+
+   // Iterate over the map using Iterator till end.
+   while (it != dev_param_map.end())
+   {
+   enum lms_dev_type dev_type = it->first;
+   struct dev_desc desc = it->second;
+
+   if (strncmp(device_info->deviceName, desc.name_prefix.c_str(), 
desc.name_prefix.length()) == 0) {
+   LOGC(DDEV, INFO) << "Device identified as " << 
desc.name_prefix;
+   return dev_type;
+   }
+   it++;
+   }
+   return LMS_DEV_UNKNOWN;
+}
+
 LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t 
chan_num, double lo_offset,
 const std::vector& tx_paths,
 const std::vector& rx_paths):
RadioDevice(tx_sps, rx_sps, iface, chan_num, lo_offset, tx_paths, 
rx_paths),
-   m_lms_dev(NULL), started(false)
+   m_lms_dev(NULL), started(false), dev_type(LMS_DEV_UNKNOWN)
 {
LOGC(DDEV, INFO) << "creating LMS device...";

@@ -138,11 +192,11 @@
 int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
 {
lms_info_str_t* info_list;
-   const lms_dev_info_t* device_info;
lms_range_t range_sr;
float_type sr_host, sr_rf;
unsigned int i, n;
int rc, dev_id;
+   struct dev_desc dev_desc;

LOGC(DDEV, INFO) << "Opening LMS device..";

@@ -179,20 +233,24 @@

delete [] info_list;

-   device_info = LMS_GetDeviceInfo(m_lms_dev);
+   dev_type = parse_dev_type(m_lms_dev);
+   dev_desc = dev_param_map.at(dev_type);

if ((ref != RE