Exemple #1
0
// Can be called to shut down. Probably not required
func (ctx *Context) destroy() {
	if ctx.initialized {
		ctx.initialized = false
		C.libusb_exit(ctx.ctx)
		ctx.ctx = nil
	}
}
Exemple #2
0
func (c *Context) Close() error {
	close(c.done)
	if c.ctx != nil {
		C.libusb_exit(c.ctx)
	}
	c.ctx = nil
	return nil
}
Exemple #3
0
func (c *Context) Close() error {
	close(c.done)
	if c.ctx != nil {
		C.libusb_exit(c.ctx)
		c.cleanupCallbacks()
	}
	c.ctx = nil
	return nil
}
Exemple #4
0
func End(handle *C.struct_libusb_device_handle) {

	log.Print("Libusb goroutine exiting\n")

	C.libusb_release_interface(handle, 0)
	C.libusb_release_interface(handle, 1)
	C.libusb_attach_kernel_driver(handle, 0)
	C.libusb_attach_kernel_driver(handle, 1)
	C.libusb_exit(nil)

	log.Print("Libusb goroutine exited\n")
}
Exemple #5
0
func main() {
	runtime.LockOSThread()
	rand.Seed(int64(time.Now().UnixNano()))
	C.libusb_init(nil)

	StartLibUsb()

	clr := color.RGBA{0xff, 0, 0, 0}
	SetColor(clr)
	EndLibUsb()

	go StartClock()
	signals := make(chan os.Signal)
	signal.Notify(signals)
	<-signals

	C.libusb_exit(nil)
}
Exemple #6
0
func (c *Context) Exit() {
	C.libusb_exit(c.me())
}
Exemple #7
0
func DesposeLib() {
	C.libusb_exit(nil)
}