Page 1 of 1
PLIN-API USB location
Posted: Sun 10. May 2020, 22:51
by MarioRodrigues
Hello,
Is there any way to get some information about the USB location of a PLIN-USB using the PLIN-API?
We're using two adapters on one PC and we would like to simplify to replacement in case of a breakdown.
We know that one way to accomplish such requirement is editing and using the Hardware IDs, but this is always a manual setup.
Our idea is to use the USB location to figure out which PLIN is connected to which bus.
Thanks in advance!
Best Regards,
Mário.
Re: PLIN-API USB location
Posted: Mon 11. May 2020, 08:29
by PEAK-Support
You could set a unique Hardware ID for each Device within the Control Panel APP.

- PLIN-View.jpg (39.98 KiB) Viewed 6291 times
With the Software API you could read the ID back, and so could decide wich PLIN-USB Device is on which LIN Channel.

- PLIN-View2.jpg (51.42 KiB) Viewed 6291 times
At the moment this is the only solution. There is no "fixing" of the Device to a LIN Channel (like we have implemented it on the CAN units)
Re: PLIN-API USB location
Posted: Tue 12. May 2020, 16:35
by MarioRodrigues
Thank you for the reply.
I'm currently implementing the update of the HardwareID with the API but the ID is not really updating.
When I execute the SetHardwareParam everything goes fine, but when I read it back the value doesn't update (I've confirmed with PLIN-View PRO).

- Capture.JPG (20.27 KiB) Viewed 6281 times
Any ideas?
Best Regards,
Mário.
Re: PLIN-API USB location
Posted: Tue 12. May 2020, 17:45
by PEAK-Support
Have you test if you could set the ID with Control Panel - as we wrote in our last post? If yes, could you read it with your code back?
Does this work ? We could give you a short C code example how to Set & Get the parameter - simply send us a e-mail to support[at]peak-system.com
Re: PLIN-API USB location
Posted: Tue 12. May 2020, 18:11
by MarioRodrigues
Yes it works fine, if I set the ID with PLIN-View PRO, I can read it back in my app.
I found out the problem, I was setting wBuffSize to 0 as you can see in the picture of my last post. Now that I understand the purpose of such parameter it's weird that the method accepts it to be 0 without "complaining".
Thank you for your support.
Best Regards,
Mário.
Re: PLIN-API USB location
Posted: Tue 12. May 2020, 18:29
by PEAK-Support
It is a global function that call different subfunction depending on the Parameter (which make it flexible for new features without changing the API)
So a validation is nearl impossible, because there exist parameters where a zero is OK.