Skip to content

Commit

Permalink
trim device usb strings, git ignore .vscode folder (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoirier committed Jun 7, 2016
1 parent e12093a commit 4251073
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ _testmain.go

# User stuff
archives
.vscode
4 changes: 3 additions & 1 deletion rtlsdr.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package rtlsdr

import (
"bytes"
"errors"
"unsafe"
)
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 4251073

Please sign in to comment.