Skip to content

Commit

Permalink
add the ability to explicitly set endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdf committed Aug 31, 2016
1 parent 132e1c3 commit 61aab8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions hid.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Device interface {
Open() error
Close()
Info() Info
SetEndpoint(int)
HIDReport() ([]byte, error)
SetReport(int, []byte) error
GetReport(int) ([]byte, error)
Expand Down
7 changes: 6 additions & 1 deletion usb_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,19 @@ type usbDevice struct {
path string
}

func (hid *usbDevice) SetEndpoint(ep int) {
hid.epOut = ep
hid.epIn = ep + 0x80
}

func (hid *usbDevice) Open() (err error) {
if hid.f != nil {
return errors.New("device is already opened")
}
if hid.f, err = os.OpenFile(hid.path, os.O_RDWR, 0644); err != nil {
return
} else {
return hid.claim()
return nil //hid.claim()
}
}

Expand Down

0 comments on commit 61aab8c

Please sign in to comment.