Now showing the serial number on the RTL-SDR

This commit is contained in:
AlexandreRouma 2022-08-27 00:31:05 +02:00
parent ad36ede26b
commit 14e37b41d4

View File

@ -121,9 +121,14 @@ public:
#ifndef __ANDROID__
devCount = rtlsdr_get_device_count();
char buf[1024];
char snBuf[1024];
for (int i = 0; i < devCount; i++) {
// Gather device info
const char* devName = rtlsdr_get_device_name(i);
sprintf(buf, "%s [%d]", devName, i);
int snErr = rtlsdr_get_device_usb_strings(i, NULL, NULL, snBuf);
// Build name
sprintf(buf, "[%s] %s##%d", (!snErr && snBuf[0]) ? snBuf : "No Serial", devName, i);
devNames.push_back(buf);
devListTxt += buf;
devListTxt += '\0';