File tree Expand file tree Collapse file tree 1 file changed +17
-21
lines changed Expand file tree Collapse file tree 1 file changed +17
-21
lines changed Original file line number Diff line number Diff line change @@ -86,29 +86,25 @@ func rawOpen(reset bool) (*Device, error) {
86
86
}
87
87
88
88
retval := & Device {}
89
- id := 0
90
- found := false
91
- // Iterate over the known device types, matching to product ID
92
- for _ , devType := range deviceTypes {
93
- if devices [id ].ProductID == devType .usbProductID {
94
- retval .deviceType = devType
95
- found = true
96
- break
89
+ for _ , device := range devices {
90
+ // Iterate over the known device types, matching to product ID
91
+ for _ , devType := range deviceTypes {
92
+ if device .ProductID == devType .usbProductID {
93
+ retval .deviceType = devType
94
+ dev , err := device .Open ()
95
+ if err != nil {
96
+ return nil , err
97
+ }
98
+ retval .fd = dev
99
+ if reset {
100
+ retval .ResetComms ()
101
+ }
102
+ go retval .buttonPressListener ()
103
+ return retval , nil
104
+ }
97
105
}
98
106
}
99
- if ! found {
100
- return nil , errors .New ("Found an Elgato device, but not one for which there is a definition; have you imported the devices package?" )
101
- }
102
- dev , err := devices [id ].Open ()
103
- if err != nil {
104
- return nil , err
105
- }
106
- retval .fd = dev
107
- if reset {
108
- retval .ResetComms ()
109
- }
110
- go retval .buttonPressListener ()
111
- return retval , nil
107
+ return nil , errors .New ("Found an Elgato device, but not one for which there is a definition; have you imported the devices package?" )
112
108
}
113
109
114
110
// GetName returns the name of the type of Streamdeck
You can’t perform that action at this time.
0 commit comments