简体   繁体   中英

How to get keyboard device id and mouse devicei id on mac os using c++

I'm trying to get the device Id for all mouse and keyboard devices plugged in to a computer. I know I probably have to use the IO Kit library but have been unable to find much information, I found this ( How to create a program to list all the USB devices in a Mac? ) but if gives the id for all the usb devices which is not quite what I want.

不要以为这是最佳解决方案,但是您可以通过以下方式获得给定类型的所有ID的列表:

std::string = std::system("lsusb | grep Keyboard | awk '{print $6}'")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM