44 Commits

Author SHA1 Message Date
Andreas Deininger
0b7848559a Fix typos (#183)
Co-authored-by: Cristian Maglie <c.maglie@bug.st>
2024-06-24 17:33:18 +02:00
Christian Stewart
42bc112d18 fix: add shims for GOARCH=wasm with GOOS=js and GOOS=wasip1
Fixes build errors:

GOOS=js GOARCH=wasm go build
GOOS=wasip1 GOARCH=wasm go build

Signed-off-by: Christian Stewart <christian@aperture.us>
2024-03-01 14:26:58 -08:00
Cristian Maglie
572f392ca9 Updated license year 2024-02-20 15:27:44 +01:00
Cristian Maglie
f3f01227e9 Fix some rare IOServiceGetMatchingServices failure on MacOSX
We had reports of users always getting:

  IOServiceGetMatchingServices failed, data changed while iterating

The issue seems related to the function getMatchingServices that
returns an always-invalid iterator even if there are no actual services.

This is a workaround for this issue.
2023-09-14 15:24:41 +02:00
Cristian Maglie
1e13b2f610 removed leftover print 2023-08-10 13:10:27 +02:00
Cristian Maglie
c9a9ed456d darwin: wrap cgo-types directly (without using a struct)
This makes easier the boxing/unboxing of the wrapped types.
2023-08-10 13:10:27 +02:00
Cristian Maglie
c1ded5fc98 darwin: moved type definitions near methods definition 2023-08-10 13:10:27 +02:00
deadprogram
80a3721f8b darwin: use Go type wrappers to avoid declaring Go methods on C types.
This is needed starting with Go 1.21 due to stricter enforcement of rules
about adding methods to existing types, now including C types.

See https://github.com/golang/go/issues/60725 for further details.

Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-08-10 13:10:27 +02:00
Cristian Maglie
386b387977 Updated license 2023-08-10 01:07:25 +02:00
Cristian Maglie
75c59a9418 Removed obsolete code 2023-08-09 18:48:09 +02:00
Cristian Maglie
e6cff1a986 windows: Avoid panic if USB Product name is empty 2023-01-02 14:44:56 +01:00
Cristian Maglie
376ad6baaf Retry port enumeration 5 times before giving up (macosx)
We observer errors getting the IOCalloutDevice string, this is a
tentative fix based on the hypotesis that the enumerator is
called too early during the USB enumeration phase.
2023-01-02 12:56:19 +01:00
Cristian Maglie
2cf9e2e281 Remove old go1.9- compatibilty files 2022-01-04 17:11:35 +01:00
Cristian Maglie
adc54fb194 Updated license years 2021-07-20 12:56:48 +02:00
Cristian Maglie
9cebdc6aa3 Small update to docs 2021-07-20 12:54:16 +02:00
Cristian Maglie
57ac200f98 windows: improved serial number detection on composite USB devices 2021-02-26 12:34:22 +00:00
Cristian Maglie
7183520fbb run of go-fmt 2021-02-26 12:34:22 +00:00
Cristian Maglie
233eb2a09b Refresh run of go generate with the latest mksyscall 2021-02-26 13:20:02 +01:00
Cristian Maglie
b62cd2386c Added support for macosx 10.11+
Seems like, starting from 10.11, IOUSBDevice has been renamed to IOUSBHostDevice.
2021-02-26 13:07:44 +01:00
Cristian Maglie
820cffa341 Added doc for new USB Product field (windows-only) 2020-04-18 22:22:31 +01:00
giacomoberlin
f0d91f6e0d Product in PortDetails struct
un-commented Product member of the struct PortDetails. This goes with the pull request "completed retrievePortDetailsFromDevInfo #40". Apologies for not submitting together...
2020-04-18 22:09:26 +01:00
giacomoberlin
4df0da8377 completed retrievePortDetailsFromDevInfo
in retrievePortDetailsFromDevInfo:
- updated call to setupDiGetDeviceRegistryProperty with the same style used elsewhere (first get the reqSize, then call)
- use of generic variable names, in case the function is extended to fetch other values than spdrpFriendlyName (or spdrpDeviceDesc)
- re-enabled the assignment of details.Product
2020-04-18 22:08:55 +01:00
giacomoberlin
900c828b75 fixed API procSetupDiGetDeviceRegistryPropertyW
confusingly, in this prototype Microsoft decided to split bufSize and reqSize
2020-04-18 22:08:08 +01:00
Cristian Maglie
88e081691b Fixed enumerator build for openbsd (unsupported operation) 2019-12-03 17:03:28 +01:00
Cristian Maglie
df95023074 Introducing go.mod for dep management 2019-12-02 19:51:36 +01:00
Cristian Maglie
24a6610f05 Updated license years
Updated to 2020 even if we are less than one month ahead.
2019-12-02 19:27:10 +01:00
Cristian Maglie
219de06186 Fixed darwin build for go1.10+ 2018-08-27 14:18:10 +02:00
Cristian Maglie
1c2446b92c Implementing compatibility with go latest
This should allow darwin to be compatible with all the latest

go1.7.x
go1.8.x
go1.9.x
2018-08-20 01:02:49 +02:00
Cristian Maglie
e42339511c Fixed wrong build tags... oops 2018-08-19 18:57:32 +02:00
Cristian Maglie
338c399730 Factored out C.IORegistryEntryCreateCFProperty method 2018-08-19 18:51:07 +02:00
Cristian Maglie
6085517433 Made error variable explicit in search loop 2018-08-19 18:41:24 +02:00
Cristian Maglie
cdac3b30e1 Removed extra parenthesis 2018-08-19 18:41:00 +02:00
Cristian Maglie
71fe05aedd Added Release method to CFTypeRef 2018-08-19 18:40:47 +02:00
Cristian Maglie
ee147ffce4 Added Release method to CFStringRef 2018-08-19 18:28:57 +02:00
Cristian Maglie
75aa16d69f CFRef are no more internally represented as pointer but as integers
This is due to improvements in CGO compiler for darwin OS
2018-08-19 18:13:24 +02:00
Cristian Maglie
ef634e5745 Removed duplicated methods on (nowadays) equivalent type C.io_*_t
This is due to improvements on the cgo builder related to darwin OS.
2018-08-19 18:11:32 +02:00
Cristian Maglie
3c7a545ca2 Removed -fconstant-cfstrings CGO build flag 2018-08-19 18:09:25 +02:00
Cristian Maglie
3ee4586c58 Splitted usb_darwing.go in two different build units based on go version 2018-08-19 18:08:03 +02:00
Veniamin Albaev
86b770d218 Enumerator: Fixed go:generate comment
It pointing to mksyscal_windows.go in local folder which already removed
2017-07-25 13:33:03 +02:00
Cristian Maglie
1ba1196861 Fixed build of USB enumerator for go compiler >=1.8.3 (@facchinm)
Fixes #30
2017-06-22 15:40:40 +02:00
Martino Facchin
51237629e6 Fix build using Darwin and osxcross 2017-02-13 16:33:49 +01:00
Cristian Maglie
11d1e54246 Updated docs for USB 2017-02-04 00:53:51 +01:00
Cristian Maglie
3ad7c6b7d2 Moved go:generate into non-GOOS specific file
See #19
2017-02-04 00:24:23 +01:00
Cristian Maglie
c8b1c23a56 Moved USB enumerations subroutines in their own package 2017-01-30 10:54:16 +01:00