Output cleanup

This commit is contained in:
Kyle Lemons
2012-03-26 22:51:37 -07:00
parent 0f572675c9
commit 86ebf94158
5 changed files with 81 additions and 11 deletions

View File

@@ -6,7 +6,6 @@ import "C"
import (
"fmt"
"log"
"reflect"
"runtime"
"unsafe"
@@ -126,7 +125,7 @@ func newConfig(cfg *C.struct_libusb_config_descriptor) *Config {
// *sigh*
runtime.SetFinalizer(c, (*Config).Close)
log.Printf("config %p initialized", c.cfg)
//log.Printf("config %p initialized", c.cfg)
return c
}
@@ -134,7 +133,7 @@ func newConfig(cfg *C.struct_libusb_config_descriptor) *Config {
// code. It should be called exactly once!
func (c *Config) Close() error {
if c.cfg != nil {
log.Printf("config %p closed", c.cfg)
//log.Printf("config %p closed", c.cfg)
C.libusb_free_config_descriptor(c.cfg)
}
c.cfg = nil

View File

@@ -5,7 +5,6 @@ package usb
import "C"
import (
"log"
"reflect"
"runtime"
"time"
@@ -27,7 +26,7 @@ func newDeviceInfo(dev *C.libusb_device) *DeviceInfo {
// I still can't get this to be called
runtime.SetFinalizer(d, (*DeviceInfo).Close)
log.Printf("deviceInfo %p initialized", d.dev)
//log.Printf("deviceInfo %p initialized", d.dev)
return d
}
@@ -60,7 +59,7 @@ func (d *DeviceInfo) Open() (*Device, error) {
// code. It should be called exactly once!
func (d *DeviceInfo) Close() error {
if d.dev != nil {
log.Printf("deviceInfo %p closed", d.dev)
//log.Printf("deviceInfo %p closed", d.dev)
C.libusb_unref_device(d.dev)
}
d.dev = nil
@@ -79,7 +78,7 @@ func newDevice(handle *C.libusb_device_handle) *Device {
// :(
runtime.SetFinalizer(d, (*Device).Close)
log.Printf("device %p initialized", d.handle)
//log.Printf("device %p initialized", d.handle)
return d
}
@@ -125,7 +124,7 @@ func (d *Device) SetConfig(cfg int) error {
func (d *Device) Close() error {
if d.handle != nil {
log.Printf("device %p closed", d.handle)
//log.Printf("device %p closed", d.handle)
C.libusb_unref_device(d.handle)
}
d.handle = nil

View File

@@ -5,7 +5,6 @@ package usb
import "C"
import (
"log"
"reflect"
"runtime"
"unsafe"
@@ -22,7 +21,7 @@ func (c *Context) Debug(level int) {
func NewContext() *Context {
c := new(Context)
log.Printf("gousb initialized")
//log.Printf("gousb initialized")
if errno := C.libusb_init(&c.ctx); errno != 0 {
panic(usbError(errno))
}
@@ -69,7 +68,7 @@ func (c *Context) ListDevices(each func(bus, addr int, desc *Descriptor) bool) (
func (c *Context) Close() error {
if c.ctx != nil {
C.libusb_exit(c.ctx)
log.Printf("gousb finished")
//log.Printf("gousb finished")
}
c.ctx = nil
return nil