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.
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).
You can execute this command :
"wmic cpu get ProcessorId"
Qt 5.11 introduced this function: QSysInfo::machineUniqueId
Related
I want to detect whether Intel Quick Sync is present and enabled on the processor. FYI, it may be disabled (powered down) if you have no video cable plugged into the motherboard, or can be disabled in the BIOS.
Thanks
Ron
There is no general solution for something like this, the code would have to be specific to the OS you are running. It would likely boil down to a system call to determine the feature set of the processor you are running i.e. maybe something like cat /proc/cpuinfo if you were running Linux for example.
There are multiple ways to execute a system call in C++. Take a look at some of the previous answers here How to execute a command and get output of command within C++ using POSIX?
You can port the Intel System Analyzer Utility for Linux to C++ from Python. That's what I ended up doing.
That tool uses the output of cat /proc/cpuinfo and lspci to collect some info about the CPU, GPU, and software installation.
Is there any way in C++ to detect if my program is being ran from a thumbdrive? Doing this for issues with USN journals.
You can try obtaining information about where's your binary located using fstat(2) on argv[0].
It's not C++ specific, it works in plain C as well.
After that you may want to enumerate USB devices connected to the system, this operation is OS-dependent (for Linux, e.g., the answer can be found here).
Using the SetupDiGetDeviceRegistryProperty function you get what you want to know.
This may be also interesting for you: GetDriveType function documented on Microsoft developer resources.
The current drive letter you get from argv [0].
I want to use the CAN-Bus interface on an Intel Q7 module with the EG20T chipset. I got it to work on Windows but now i have to get it to work on Linux but I barely find any information.
I just need to know how I can read, write messages, start, stop and to set the baud-rate of the CAN-Bus.
So far I found this: http://cateee.net/lkddb/web-lkddb/PCH_CAN.html
and some comments about can4linux and socketCan for shell usage.
But I actually need to know how to use it within a C or C++ programm.
Looks like that driver is a SocketCan driver. Just compile and load the module, and then your device will look like a network interface.
http://www.brownhat.org/docs/socketcan/llcf-api.html
This link has information about how to send messages and such.
Good luck!
Look here for more information about socketcan and linux implementation:
socketcan
Modern Linux distributions provide SocketCAN drivers from stock. So there is no need to compile the driver yourself.
SocketCAN project provides utils for sending/receiving CAN frames and other related tasks. Please see this repository: https://github.com/linux-can/can-utils
There is also a central SocketCAN dedicated wiki: http://elinux.org/CAN_Bus
I want to see CPU temperature and CPU load in Windows. I have to write it myself not using software like Core Temp. How can I access this information?
I read a similar question to mine, but there was no useful answer:(.
Recently I have started a similar project. I needed to read the cpu temperature and to control the fan in Linux and Windows. I don't know much about C++ and VS and DDK but I figured how to write a simple kernel driver and a simple program with winring0. In my laptop (and most other) the temperature and the fan is controled by the embedded controller. You have 2 choices, either you can write a kernel driver or you can use a library to access the embedded controller. It's because Windows protect the ec from being accessed with normal user rights. A good (and working) library is winring0 (WinRing0_1_3_1b). A useful program to check the ec and everything else in Windows is the RW tool.
Take a look at Getting CPU temp from MSDN forums, there are a few approaches.
As to the sane way, you can use Win32_TemperatureProbe class, that gets its intel from SMBIOS.
I want to find the interface supplied by windows to change the CPU frequency and core voltage.
Thanks!
you can change frequency by using
PowerWriteACValueIndex()/PowerWriteDCValueIndex()
when setting the same index value for both
GUID_PROCESSOR_THROTTLE_MAXIMUM | GUID_PROCESSOR_THROTTLE_MINIMUM
all the GUID description could be found in winnt.h
you cannot change CPU voltage by WINAPI. you should use the privileged commands to write to specific MSRs (see AMD/Intel docs) via system kernel driver.
you cannot change Intel CPU voltage AT ALL since Nehalem micro-architecture. Intel officially does not supply MSRs to write voltage values (VIDs) by software.
From Windows Native Processor Performance Control(document link)
Parameters to P-state policy
Several parameters to Windows processor performance state controls are configurable via registry keys. These keys are provided with the intent that OEMs and system designers may tune the performance of Windows processor power management features to best suit specific platform designs, and allow adjustment to help achieve maximum battery life and realize the best system performance.
And you have to restart to have the changes take effect.
Microsoft Windows does not have an API for overclocking / underclocking a CPU. You would have to roll your own using your assembler skills.
I can do no more than point you in the right direction. I think through Windows Management Instrumentation (WMI) you can get at a COM interface that allows modification of some sub-systems.
Hopefully that vague bit of information will set you on the right path. :-)