Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blink1 mk3 doesn't seem to be able to open properly #7

Open
kazrakcom opened this issue Aug 25, 2020 · 6 comments
Open

Blink1 mk3 doesn't seem to be able to open properly #7

kazrakcom opened this issue Aug 25, 2020 · 6 comments

Comments

@kazrakcom
Copy link

Attempting to open a mk3 seems to fail with "all devices busy".

Tossing some logging into OpenNextDevice, it appears that openDevices[dev.Device] is not nil even for a freshly-inserted mk3. I see "&{0xc00009b3e0 100ms {0 0 0 0 0s 10ms}}" as the value there.

I'm investigating further, but logging this here for reference.

@kazrakcom
Copy link
Author

Okay. Marking as closed; mk3 handles reopening differently, but it's my fault. One must explicitly Close() before it can be found with OpenNextDevice().

@kazrakcom
Copy link
Author

Attempting to write to a mk3 fails for unclear reasons.

@kazrakcom kazrakcom reopened this Aug 25, 2020
@kazrakcom
Copy link
Author

package main

import (
blink1 "github.com/hink/go-blink1"
)

func main() {
device, err := blink1.OpenNextDevice()
if err != nil {
panic(err)
}
err = device.SetState(blink1.State{Red: 255})
if err != nil {
panic(err)
}
}

Works fine on a mk2, running on a mk3 gives:

panic: Unable to write to blink(1)

goroutine 1 [running]:
main.main()
[path]/test.go:14 +0x87
exit status 2

@todbot
Copy link

todbot commented Aug 25, 2020

Could the problem be that at line:
https://github.com/hink/go-blink1/blob/master/libusb/blink1.go#L19
That first byte is the reportId and it should be 1 instead of 0. I believe blink(1) mk1 and mk2 devices did not explicitly check the reportId but mk3 devices do because it supports two different reports.

@todbot
Copy link

todbot commented Aug 26, 2020

I believe I have found the problem. I have submitted PR #8 to address it.

@mgumz
Copy link

mgumz commented Jun 23, 2023

@kazrakcom yep, @todbot's patch works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants