You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was pleasantly surprised the enumerator subpackage supports USB VID/PID numbers so it's possible to filter serial ports on them.
However, I found that VID and PID are stored as strings? That doesn't make a lot of sense to me, as these are 16-bit numbers and we have a Go type for this: uint16. strconv.ParseUint works, but requires extra error handling and in general seems less reliable. Example code:
Maybe this ship has sailed already (because of API breakage)
Yes, that's a big problem... maybe in a future major release we may change them, but in the meantime, it's a nice idea to use uint16 so I'll probably add the "integer" fields together with the already existing ones...
I was pleasantly surprised the enumerator subpackage supports USB VID/PID numbers so it's possible to filter serial ports on them.
However, I found that VID and PID are stored as strings? That doesn't make a lot of sense to me, as these are 16-bit numbers and we have a Go type for this:
uint16
.strconv.ParseUint
works, but requires extra error handling and in general seems less reliable. Example code:Maybe this ship has sailed already (because of API breakage) but in my opinion changing this to use
uint16
would make the API easier to use.For reference: tinygo-org/tinygo#1956
The text was updated successfully, but these errors were encountered: