cancel
Showing results for 
Search instead for 
Did you mean: 

Need an Help to to read the Laptops/TAB's VID and PID using STM32F103 Series MCU Via Type C usb

sivarajnxgen
Associate

Hi Team, 

     We are using the STM32F103RDT6 microcontroller in one of our projects. The end-user application of our project is a laptop vending machine. Simply put, students can acquire laptops/tablets by using their IDs. However, we are facing difficulties in verifying whether the laptops/tablets returned by the students are the same devices they took. All of the devices are Type-C only.

Therefore, we are planning to automatically read the Vendor ID (VID) and Product ID (PID) of the devices (laptops/tablets) using the STM32 microcontroller. Can you suggest or help us with the procedure to make this happen? Is it possible to read the Product ID using STM32?

This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Andrew Neil
Super User

Surely, the VID & PID are properties of the USB Device (ie, your STM32) - not the Host (ie, the laptop) ?

:thinking_face:

https://www.oshwa.org/2013/11/19/new-faq-on-usb-vendor-id-and-product-id/#:~:text=USB%20vendor%20IDs%20(VID)%20and%20product%20IDs%20(PID)%20are%2016%2Dbit%20numbers%20used%20to%20identify%20USB%20devices%20to%20a%20computer%20or%20other%20host

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

It sounds like, you have a misunderstanding about USB VID and PID:
as Andrew Neil has pointed out: the VID and PID are provided by a USB Device:

If you connect a laptop with an USB Device - this USB device (your STM32 MCU) will send the VID and PID:

  • but these VID and PID are usually associated with a driver which the laptop has to activate (in order to talk to the STM32 MCU): the laptop needs to get the USB Enumeration from the device, e.g. if is it a Mass Storage Device (USB memory stick), a VCP UART, a HID device (mouse and keyboard) or something else.
  • and "hijacking" an USB VID is not "legal":
    every vendor of USB Devices (e.g. Memory Sticks) has a VID: this is registered, and these companies might pay for the database entry. You cannot simply "fake" or "hijack" a vendor ID (it is not legal; it belongs to a company "following the rules" for USB product registration)

So, I assume this use case:

  • all the laptops are connected on an STM32 MCU which should "assign" a unique ID to every laptop (before rented or taken away)
  • if a student grabs a laptop - you want to verify later, when they return the laptop, if is the "same" one.

What you could do:

  • all the laptops are connected to an STM32 MCU (via USB)
  • but the laptop "talks" to the STM32 MCU (e.g. via VCP UART)
  • and every laptop receives a Unique ID from STM32 MCU - check out what UUID is!
  • Such a UUID can be a combination of time, data, a random number...
  • store this UUID, assigned by a STM32 MCU somewhere on the laptop (e.g. in registry): you need a special application running on laptop, the users have to start, e.g. a "RentMeApp"
  • this stores such an UUID, generated by a STM32 MCU (when connected via USB to it)
  • Later, when returning the laptops: you start a SW App again, on laptop, which looks for the stored UUID
    and displays it (e.g. an App "ReturnMeApp": it will display (and maybe decode) the UUID assigned and stored - now you can check which laptop was returned
  • You need SW on your laptop: STM32 with USB cannot "solve" your issue.
    (all laptops would connect to the same STM32 MCU with the same VID and PID - you need other means to realize which laptop is which, e.g. via UUID, generated by the STM32 MCU)

@tjaekel wrote:
  • You need SW on your laptop: STM32 with USB cannot "solve" your issue [alone].

^^^ This! ^^^

Some other things often used for creating a "Unique ID" for a computer include:

  • Hard driver serial number
  • Ethernet / WiFi / BT MAC(s)

https://stackoverflow.com/questions/99880/generating-a-unique-machine-id 

https://licensespring.com/blog/guide/a-complete-guide-about-computer-ids/#:~:text=software%20license%20so.-,What%20are%20Different%20Ways%20to%20Generate%20a%20Device%20ID%3F,-Manual%20assignment%3A%20One 

I guess, on a modern PC, the TPM could be used?

https://learn.microsoft.com/en-gb/windows/security/hardware-security/tpm/trusted-platform-module-overview

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.