winusb

package module
v0.0.0-...-3b92d8f Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SP_DEVICE_INTERFACE_DATA

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

type SP_DEVINFO_DATA

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

type SetupDi

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

func NewSetupDi

func NewSetupDi() (*SetupDi, error)

func (*SetupDi) EnumUsbDev

func (sdi *SetupDi) EnumUsbDev(vid uint16, pid uint16) ([]string, error)

port, serial, ???

func (*SetupDi) GetDetailPath

func (sdi *SetupDi) GetDetailPath(hdi uintptr, did uintptr) (string, error)

func (*SetupDi) GetInstanceID

func (sdi *SetupDi) GetInstanceID(hdi uintptr, sdd uintptr) (string, error)

func (*SetupDi) ScanUsbDev

func (sdi *SetupDi) ScanUsbDev(vid uint16, pid uint16) (string, error)

func (*SetupDi) TransFullPath

func (sdi *SetupDi) TransFullPath(insid string) (string, error)

使用 InstanceID 查找 SP_DEVINFO_DATA. 再使用 SP_DEVINFO_DATA 来获取 DetailPath.

type UsbDevice

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

func (*UsbDevice) ActualRead

func (udv *UsbDevice) ActualRead() ([]byte, error)

func (*UsbDevice) BulkRead

func (udv *UsbDevice) BulkRead(p []byte) (int, error)

func (*UsbDevice) BulkWrite

func (udv *UsbDevice) BulkWrite(p []byte) error

func (*UsbDevice) Close

func (udv *UsbDevice) Close() error

func (*UsbDevice) ControlVendorRead

func (udv *UsbDevice) ControlVendorRead(request uint8, wValue uint16, wIndex uint16, p []byte) (int, error)

func (*UsbDevice) ControlVendorWrite

func (udv *UsbDevice) ControlVendorWrite(request uint8, wValue uint16, wIndex uint16, p []byte) (int, error)

func (*UsbDevice) PrepareRead

func (udv *UsbDevice) PrepareRead(cnt int) error

创建并行读操作需要的, 多个 overlap 结构体. 然后发起多个并行读操作.

func (*UsbDevice) SetBulkInPolicy

func (udv *UsbDevice) SetBulkInPolicy(idx int, uval uint32) error

func (*UsbDevice) SetBulkOutPolicy

func (udv *UsbDevice) SetBulkOutPolicy(idx int, uval uint32) error

type WinUsbApi

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

func NewUsbApi

func NewUsbApi() (*WinUsbApi, error)

func (*WinUsbApi) OpenDevice

func (wupi *WinUsbApi) OpenDevice(dpth string) (*UsbDevice, error)

func (*WinUsbApi) OpenUsbDevice

func (wupi *WinUsbApi) OpenUsbDevice(dpth string) (*UsbDevice, error)

相比上面 OpenDevice 函数, 减少若干检查项目.

Jump to

Keyboard shortcuts

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