Allocate libusb buffers in C (#11)

* add alloc/free_transfer_and_buffer. Manages the buffer memory on the C
side.

* switch libusb.go to use the new alloc/free_transfer_and_buffer. Add
a new buffer() call to get access to the allocated buffer as a Go slice.

* Fake USB transfer uses the new alloc/free/buffer interface.

* Switch to the new libusb.alloc signature, where libusb owns the buffer.

* newUSBTransfer now allocates a separate buffer, do a copy on
endpoint.transfer.

* newUSBTransfer will now allocate it's own buffer.

* Enable autodetach in rawread.
This commit is contained in:
zagrodzki
2017-08-29 12:11:04 +02:00
committed by GitHub
parent bc91dd3f2c
commit 1aaa100bdb
8 changed files with 82 additions and 28 deletions

View File

@@ -140,6 +140,9 @@ func main() {
}
dev := devs[0]
log.Print("Enabling autodetach")
dev.SetAutoDetach(true)
log.Printf("Setting configuration %d...", *config)
cfg, err := dev.Config(*config)
if err != nil {