How does QGC recognize hardware types?

Dear all,
I have a question in terms of QGC recognizing px4 hardwares. When I connect pixracer to QGC to flash firmware, it can precisely recognize this is a fmuv4 hardware. How can it achieve that?
Any advise is appreciated.

Boards report unique ids. You should see it reported in the text of the firmware flashing page in QGC.

Thanks for the reply. I saw it. I just want to know how the boards know their unique ID. Is it set in advance or something else?
EDIT: when the board only has bootloader (no firmware flashed) in it, it still knows its ID. How is it achieved?

It’s set in the bootloader.

Oh, yes! I see. Thanks!