Don't use hardcoded values

master
Steven Polley 4 years ago
parent ce763a9957
commit 400705f8b8
  1. 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…
Cancel
Save