How to create a program to list all the USB devices in a Mac?

前端 未结 3 883
小蘑菇
小蘑菇 2021-02-01 05:37

I have a limited exposure to the Mac OS X operating system and now I have started using Xcode and am studying about I/O kit. I need to create a program in Xcode under command li

3条回答
  •  感情败类
    2021-02-01 06:30

    You just need to access the IOKit Registry. You may well be able to use the ioreg tool to do this (e.g. run it via system() or popen()). If not then you can at least use it to verify your code:

    Info on ioreg tool:

    $ man ioreg
    

    Get list of USB devices:

    $ ioreg -Src IOUSBDevice
    

提交回复
热议问题