Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idProduct and idVendor in Windows OS #69

Open
Ivra23 opened this issue Jul 31, 2020 · 5 comments
Open

idProduct and idVendor in Windows OS #69

Ivra23 opened this issue Jul 31, 2020 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@Ivra23
Copy link

Ivra23 commented Jul 31, 2020

Hello,

For begin thank you for library, i have question can you get the Port Properties in Windows and linux OS with jssc, like idProduct and idVendor.
and you're now in jssc 2.9 but in maven it's 2.8.0 ? exactly
thank you.

@pietrygamat
Copy link
Collaborator

This fork has just been published to maven central minutes ago under

<dependency>
    <groupId>io.github.java-native</groupId>
    <artifactId>jssc</artifactId>
    <version>2.9.2</version>
</dependency>

As to requested feature, I'd love to see it too.

@tresf
Copy link

tresf commented Jul 31, 2020

idProduct and idVendor

Last I checked, serial was anonymous. For example, on windows, a COM port would simply be a physical port, or if emulated, an emulated port. What is this in regards to? Can you link an example, perhaps in another language?

@pietrygamat
Copy link
Collaborator

pietrygamat commented Jul 31, 2020

I'd hate to take over the thread, but I guess my problem is very similar to @Ivra23 's. Windows does expose a bunch of information about the devices listed as COM ports - among others its HardwareID with VID and PID. Having these information provided with the port name would help a lot in autodetecting correct COM port and take the burden of finding one off of user.

Capture

Similarly, on Linux the ports listed by jssc are only those under /dev/tty*, but searching under /dev/serial/by-id gives a lot more information about the device connected:

$ ls -al /dev/serial/by-id/
total 0
drwxr-xr-x 2 root root 100 Aug  1 00:16 .
drwxr-xr-x 4 root root  80 Jul 31 23:32 ..
lrwxrwxrwx 1 root root  13 Aug  1 00:12 usb-FTDI_USB__-__Serial-if00-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root  13 Jul 31 23:32 usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root  13 Aug  1 00:16 usb-STMicroelectronics_STM32_Virtual_COM_Port_6D7218725156-if00 -> ../../ttyACM0

Since the developer may expect to talk only to certain types of devices in their app, they'd want to have more information about each available port.

Since the VID and PID are mentioned, the requirement may very well only apply to USB-to-Serial converters, and the most popular java libs for USB device management are awfully unhelpfull in any attempts to match serial port name with USB device. Approaching from the serial side may be a better idea.

@tresf
Copy link

tresf commented Jul 31, 2020

I believe you're taking about the USB protocol of it all, no? What would be the vendor of an on-board serial port? What's being requested may be more of a USB API. A code snippet should be provided as a proof of concept. If other OSs expose this information, that would be nice.

Last I checked most COM ports where embedded FTDI controllers, so having a device example, code to grab it would be a great use-case to start with.

Edit: I see you've provided some examples. Thanks

@pietrygamat
Copy link
Collaborator

This work seems to crack it:
scream3r#113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants