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))
|
scanner := bufio.NewScanner(bytes.NewReader(lsusbOut))
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
if strings.Contains(scanner.Text(), "Bose Corp.") {
|
if strings.Contains(scanner.Text(), "Bose Corp.") {
|
||||||
busID := "002"
|
fields := strings.Fields(scanner.Text())
|
||||||
devID := "005"
|
busID := fields[1]
|
||||||
|
devID := fields[3][0:3]
|
||||||
usbFilename := C.CString(fmt.Sprintf("/dev/bus/usb/%s/%s", busID, devID))
|
usbFilename := C.CString(fmt.Sprintf("/dev/bus/usb/%s/%s", busID, devID))
|
||||||
C.resetUSB(usbFilename)
|
C.resetUSB(usbFilename)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user