hiddevice

package
v0.0.0-...-c3430d8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HidDevice

type HidDevice struct {
	io.ReadWriteCloser
}

HidDevice should be used to wrap a *hid.Device when used with `Communication`.

On macOS only, we want to write only 64 bytes at a time. There was a bug in the BitBox firmware (fixed in v9.23.1, see https://github.com/BitBoxSwiss/bitbox02-firmware/pull/1526) - when signing a transaction, during the second inputs pass, 128 bytes are written to the hid device in one shot, which results in a IOKit Timeout error. Writing only 64 bytes at a time (the HID report size) fixes that. Otherwise we feed as many bytes as possible, which is important especially on iOS, where we want to send as much as possible over Bluetooth instead of many little chunks. / From BitBox02 v9.23.1 onwards, this fix is not required, but we also saw some cases of firmware upgrades failing on macOS, and we suspect the same bug in the bootloader <v1.1.2 might be causing it, and writing 64 bytes at a time might fix it.

func New

func New(device hid.Device) *HidDevice

New wraps a hid device to write only 64 bytes at a time on macOS.

func (*HidDevice) Write

func (d *HidDevice) Write(data []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL