Documentation ¶
Overview ¶
Package usart implements a framing protocol for messages sent over UART.
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrEndpointUnavailable is returned if the device returns an endpoint error, which means we are talking to the wrong endpoint (firmware vs. bootloader).
Functions ¶
This section is empty.
Types ¶
type Communication ¶
type Communication struct {
// contains filtered or unexported fields
}
Communication implements a framing protocol for messages sent over UART.
func NewCommunication ¶
func NewCommunication( device io.ReadWriteCloser, cmd byte, ) *Communication
NewCommunication creates a new Communication. cmd is the U2F CMD byte which is sent and which is expected in responses.
func (*Communication) Close ¶
func (communication *Communication) Close()
Close closes the underlying device.
func (*Communication) Query ¶
func (communication *Communication) Query(request []byte) ([]byte, error)
Query sends a request and waits for the response. Blocking.
func (*Communication) ReadFrame ¶
func (communication *Communication) ReadFrame() ([]byte, error)
ReadFrame reads a message encoded in a usart frame.
func (*Communication) SendFrame ¶
func (communication *Communication) SendFrame(msg []byte) error
SendFrame sends one message enclosed in a usart frame.
Click to show internal directories.
Click to hide internal directories.