eyetoy

package
v0.0.0-...-615049c Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Constants for eyetoy package

Scan USB devices for the correct eyetoy device

Index

Constants

View Source
const EyeToyPrimaryConfig int = 1 // only one configuration
View Source
const EyeToyPrimaryEndpoint int = 1
View Source
const EyeToyPrimaryInterface int = 0 // only one interface
View Source
const SonyEyeToyProductID uint16 = 340 // 0x0154 Eyetoy Audio Device
View Source
const SonyEyeToyVendorID uint16 = 1356 //0x054c Sony Corp.

Variables

This section is empty.

Functions

This section is empty.

Types

type EyeToy

type EyeToy struct {
	Context *gousb.Context
	Device  *gousb.Device
	Config  *gousb.Config
}

EyeToy encapsulates known interactions with the Sony EyeToy

func (*EyeToy) Close

func (e *EyeToy) Close()

Close closes out the device connection and context

func (*EyeToy) GetContext

func (e *EyeToy) GetContext()

GetContext acquires a new gousb context and injects it into *EyeToy

func (*EyeToy) GetInterfaceEndpoint

func (e *EyeToy) GetInterfaceEndpoint(alt int) (*gousb.Interface, func(), *gousb.InEndpoint, error)

GetInterfaceEndpoint returns an interface of the given Alternate with a done/Close function as well as the only endpoint available (0x81 1:IN)

iface, done, endpoint, err := eyetoy.GetInterfaceEndpoint(1)
if err != nil {
	// handle error
}
buf := make([]byte, endpoint.Desc.MaxPacketSize)
readBytes, err := endpoint.Read(buf)
done()

func (*EyeToy) Open

func (e *EyeToy) Open() error

Open opens the device with our known VID and PID. It sets autodetach to prevent kernel module interference, then acquires the only known working config for this device and places both inside *EyeToy

e := &EyeToy{}
e.GetContext()
err := e.Open()
if err != nil {
	// handle error
}

func (*EyeToy) ReadEndpoint

func (e *EyeToy) ReadEndpoint(ep *gousb.InEndpoint) (int, []byte, error)

ReadEndpoint reads one Packet from the given endpoint

Jump to

Keyboard shortcuts

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