Don't use hardcoded values
This commit is contained in:
parent
ce763a9957
commit
400705f8b8
5
main.go
5
main.go
@ -57,8 +57,9 @@ func main() {
|
||||
scanner := bufio.NewScanner(bytes.NewReader(lsusbOut))
|
||||
for scanner.Scan() {
|
||||
if strings.Contains(scanner.Text(), "Bose Corp.") {
|
||||
busID := "002"
|
||||
devID := "005"
|
||||
fields := strings.Fields(scanner.Text())
|
||||
busID := fields[1]
|
||||
devID := fields[3][0:3]
|
||||
usbFilename := C.CString(fmt.Sprintf("/dev/bus/usb/%s/%s", busID, devID))
|
||||
C.resetUSB(usbFilename)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user