Closed jcw closed 7 years ago
Are you building natively on macos?
Yes.
argh, this should not happen, I'll check this out in the coming days (and also use that time to merge some pending PR...)
In the meantime, as a temporary workaround, you can replace the nativeGetDetailedPortList
function in usb_darwin.go
with a fake placeholder, something like:
func nativeGetDetailedPortsList() ([]*PortDetails, error) {
var ports []*PortDetails
// [...removed everything...]
return ports, nil
}
// [...removed all the following functions...]
Thank you - that workaround works fine. No rush, btw.
Untested fix (will report if ok after testing on real hardware):
diff --git a/vendor/go.bug.st/serial.v1/enumerator/usb_darwin.go b/vendor/go.bug.st/serial.v1/enumerator/usb_darwin.go
index b02de12..4cb9f61 100644
--- a/vendor/go.bug.st/serial.v1/enumerator/usb_darwin.go
+++ b/vendor/go.bug.st/serial.v1/enumerator/usb_darwin.go
@@ -152,13 +152,13 @@ func (me *C.io_registry_entry_t) GetStringProperty(key string) (string, error) {
}
defer C.CFRelease(property)
- if ptr := C.CFStringGetCStringPtr(property, 0); ptr != nil {
+ if ptr := C.CFStringGetCStringPtr((C.CFStringRef)(unsafe.Pointer(property)), 0); ptr != nil {
return C.GoString(ptr), nil
}
// in certain circumstances CFStringGetCStringPtr may return NULL
// and we must retrieve the string by copy
buff := make([]C.char, 1024)
- if C.CFStringGetCString(property, &buff[0], 1024, 0) != C.true {
+ if C.CFStringGetCString((C.CFStringRef)(property), &buff[0], 1024, 0) != C.true {
return "", fmt.Errorf("Property '%s' can't be converted", key)
}
return C.GoString(&buff[0]), nil
@@ -173,7 +173,7 @@ func (me *C.io_registry_entry_t) GetIntProperty(key string, intType C.CFNumberTy
}
defer C.CFRelease(property)
var res int
- if C.CFNumberGetValue(property, intType, unsafe.Pointer(&res)) != C.true {
+ if C.CFNumberGetValue((C.CFNumberRef)(property), intType, unsafe.Pointer(&res)) != C.true {
return res, fmt.Errorf("Property '%s' can't be converted or has been truncated", key)
}
return res, nil
Hello - I'm trying out the
GetDetailedPortsList()
, because it'd be a great way to help choosing from a list of serial ports to connect to, but get the following errors on macOS 10.12.4:The irony being that on macOS, I don't really need this, since the
/dev/tty.*
names are usually self-descriptive already (i.e. serial # included in device name). For Linux and Windows however, that extra information would be very useful, especially since assigned device names can change.Is there a way to disable the macOS variants to avoid the above errors, and still get this functionality for Linux and Windows? (I'm guessing it can be done with some mix of blah_arch.go and blah.go files)