usb

package
v0.0.0-...-080cee2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SupportedDevices = DeviceMap{
		SDRHackRFOne: {
			VendorID:  0x1d50,
			ProductID: 0x6089,
			Name:      "HackRFOne",
			ResetCMD:  exec.Command("hackrf_spiflash", "-R"),
		},
		SDRHackRFJawbreaker: {
			VendorID:  0x1d50,
			ProductID: 0x604b,
			Name:      "HackRFJawbreaker",
			ResetCMD:  exec.Command("hackrf_spiflash", "-R"),
		},
		ModemSIM7600: {
			VendorID:  0x1e0e,
			ProductID: 0x9001,
			Name:      "Simtech SIM7[5|6]00",
		},
	}
)

fixme required usb permissions for accessing the modem

Functions

func NewNotFoundError

func NewNotFoundError(msg string) error

func NewStuckError

func NewStuckError(msg string) error

func NewVanishedError

func NewVanishedError(msg string) error

func ParseHexUINT16

func ParseHexUINT16(str string) (uint16, error)

Types

type Device

type Device struct {
	ResetCMD  *exec.Cmd
	Name      string
	VendorID  gousb.ID
	ProductID gousb.ID
}

func (*Device) String

func (d *Device) String() string

type DeviceMap

type DeviceMap map[DeviceType]*Device

type DeviceTuple

type DeviceTuple struct {
	*Device
	DeviceType
}

func FindSupportedDeviceTuple

func FindSupportedDeviceTuple(vendorID gousb.ID, productID gousb.ID) (DeviceTuple, bool)

type DeviceType

type DeviceType int
const (
	Unknown DeviceType = iota
	// SDRs
	SDRHackRFOne
	SDRHackRFJawbreaker
	// Modems
	ModemSIM7600
)

type NotFoundError

type NotFoundError struct {
	// contains filtered or unexported fields
}

func (*NotFoundError) Error

func (n *NotFoundError) Error() string

func (*NotFoundError) Is

func (n *NotFoundError) Is(e error) bool

type StuckError

type StuckError struct {
	// contains filtered or unexported fields
}

func (*StuckError) Error

func (s *StuckError) Error() string

func (*StuckError) Is

func (s *StuckError) Is(e error) bool

type USBDeviceManager

type USBDeviceManager struct {
	sync.Mutex
	sync.WaitGroup
	// contains filtered or unexported fields
}

func NewUSBDeviceManager

func NewUSBDeviceManager() *USBDeviceManager

func (*USBDeviceManager) FindSupportedDevices

func (m *USBDeviceManager) FindSupportedDevices() DeviceMap

func (*USBDeviceManager) HotplugReceived

func (m *USBDeviceManager) HotplugReceived(VendorID uint16, productID uint16, wasAdded bool)

func (*USBDeviceManager) ResetDevice

func (m *USBDeviceManager) ResetDevice(target DeviceType) error

func (*USBDeviceManager) Shutdown

func (m *USBDeviceManager) Shutdown()

type VanishedError

type VanishedError struct {
	// contains filtered or unexported fields
}

func (*VanishedError) Error

func (n *VanishedError) Error() string

func (*VanishedError) Is

func (n *VanishedError) Is(e error) bool

Jump to

Keyboard shortcuts

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