我需要在Mac中获得ioreg的输出以便进一步处理,但是它使用的树状结构很难解析?有没有什么方法可以把输出转换成XML或者更容易解析的格式(比如system_profiler)?
+-o Root <class IORegistryEntry, retain 12>
| {
| ...
| }
|
+-o MacBookPro5,1 <class IOPlatformExpertDevice, registered, matched, active, busy 0, retain 25>
| {
| ...
| }
|
+-o AppleACPIPlatformExpert <class AppleACPIPlatformExpert, registered, matched, active, busy 0, retain 51>
| | {
| | ...发布于 2009-02-25 20:29:46
漫长的道路可能是将源代码抓取到ioreg并对其进行修改……
https://opensource.apple.com/source/IOKitTools/IOKitTools-108/ioreg.tproj/
下载:
将#include <IOKit/IOKitLibPrivate.h>和#include <IOKit/IOKitKeysPrivate.h >更改为#include "IOKitLibPrivate.h"和#include "IOKitKeysPrivate.h",以便可以在两个文件位于同一目录时进行编译,然后使用
cc -o ioreg ioreg.c -framework Foundation -framework IOKit -lcurseshttps://stackoverflow.com/questions/587693
复制相似问题