diff --git a/.gitignore b/.gitignore index 4672980..3747519 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ _testmain.go # User stuff archives +.vscode diff --git a/rtlsdr.go b/rtlsdr.go index ac9cf2f..2151d07 100644 --- a/rtlsdr.go +++ b/rtlsdr.go @@ -8,6 +8,7 @@ package rtlsdr import ( + "bytes" "errors" "unsafe" ) @@ -196,7 +197,8 @@ func GetDeviceUsbStrings(index int) (manufact, product, serial string, err error (*C.char)(unsafe.Pointer(&m[0])), (*C.char)(unsafe.Pointer(&p[0])), (*C.char)(unsafe.Pointer(&s[0])))) - return string(m), string(p), string(s), libError(i) + return string(bytes.Trim(m, "\x00")), string(bytes.Trim(p, "\x00")), + string(bytes.Trim(s, "\x00")), libError(i) } // GetIndexBySerial returns a device index by serial id.