File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -85,10 +85,14 @@ func (d *DFUDiscovery) Stop() error {
85
85
}
86
86
87
87
// StartSync is the handler for the pluggable-discovery START_SYNC command
88
- func (d * DFUDiscovery ) libusbSync (eventCB discovery.EventCallback , errorCB discovery.ErrorCallback ) error {
89
- if cErr := C .libusbOpen (); cErr != nil {
90
- return fmt . Errorf ( "can't open libusb: %s" , C . GoString ( cErr ))
88
+ func (d * DFUDiscovery ) StartSync (eventCB discovery.EventCallback , errorCB discovery.ErrorCallback ) error {
89
+ if err := d .libusbOpen (); err != nil {
90
+ return err
91
91
}
92
+ return d .sync (eventCB , errorCB )
93
+ }
94
+
95
+ func (d * DFUDiscovery ) libusbSync (eventCB discovery.EventCallback , errorCB discovery.ErrorCallback ) error {
92
96
if err := C .libusbHotplugRegisterCallback (); err != nil {
93
97
return errors .New (C .GoString (err ))
94
98
}
Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ import (
24
24
discovery "github.com/arduino/pluggable-discovery-protocol-handler/v2"
25
25
)
26
26
27
- // StartSync is the handler for the pluggable-discovery START_SYNC command
28
- func (d * DFUDiscovery ) StartSync (eventCB discovery.EventCallback , errorCB discovery.ErrorCallback ) error {
27
+ func (d * DFUDiscovery ) sync (eventCB discovery.EventCallback , errorCB discovery.ErrorCallback ) error {
29
28
return d .libusbSync (eventCB , errorCB )
30
29
}
Original file line number Diff line number Diff line change @@ -26,8 +26,7 @@ import (
26
26
discovery "github.com/arduino/pluggable-discovery-protocol-handler/v2"
27
27
)
28
28
29
- // StartSync is the handler for the pluggable-discovery START_SYNC command
30
- func (d * DFUDiscovery ) StartSync (eventCB discovery.EventCallback , errorCB discovery.ErrorCallback ) error {
29
+ func (d * DFUDiscovery ) sync (eventCB discovery.EventCallback , errorCB discovery.ErrorCallback ) error {
31
30
ctx , cancel := context .WithCancel (context .Background ())
32
31
d .close = cancel
33
32
You can’t perform that action at this time.
0 commit comments