Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can get I a hardware ID in Qt

I can't get the CPU ID or motherboard serial number in all operating system (cross platform Qt)

On Windows I'm using WMI and on Mac another. I want use a cross-platform library.

like image 678
Amir Movahedi Avatar asked Feb 01 '14 12:02

Amir Movahedi


1 Answers

Although Qt detects at runtime the CPU feature set (cf. src/corelib/tools/qsimd.cpp), it does not export any function to access that (nor any other CPUID information). Write your small piece of assembly code to gather that information. - source

You will have to write some platform dependent code to retrieve this information.

For the CPU id you should probably look into the function __cpuid() for Windows and this answer can help you out on getting it for Linux.

Doing this you might want to consider reading up on motherboard serial numbers as not all of them provide this information at the same place (most do not provide it at all).

like image 122
Floris Velleman Avatar answered Nov 08 '22 11:11

Floris Velleman