aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Lao Beyer <lukas@electronics.kitchen>2017-04-22 13:42:34 -0400
committerDimitri Stolnikov <horiz0n@gmx.net>2017-06-11 23:52:12 +0200
commit1693e4e9d802b8420c022b7c64a7d40551d37884 (patch)
tree17934a9a4c9c26a039d79f159e1b4ee504bbf8d9
parent3c7d3f166401b1af6afd903b8d2b9729e8897189 (diff)
FreeSRP: Add support for multiple devices in get_devices
-rw-r--r--lib/freesrp/freesrp_common.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/freesrp/freesrp_common.cc b/lib/freesrp/freesrp_common.cc
index 77db220..cbbf1c3 100644
--- a/lib/freesrp/freesrp_common.cc
+++ b/lib/freesrp/freesrp_common.cc
@@ -116,18 +116,18 @@ vector<string> freesrp_common::get_devices()
{
vector<string> devices;
- try
- {
- ::FreeSRP::FreeSRP srp;
+ vector<string> serial_numbers = ::FreeSRP::FreeSRP::list_connected();
- string str;
- str = "freesrp=0,label='FreeSRP'";
+ int index = 0;
- devices.push_back(str);
- }
- catch(const ConnectionError &err)
+ for(string &serial : serial_numbers)
{
- // No FreeSRP found.
+ index++;
+
+ string str;
+ str = "freesrp=" + serial + ",label='FreeSRP " + to_string(index) + "'";
+
+ devices.push_back(str);
}
return devices;