Help - Search - Members - Calendar
Full Version: Using "ioreg" command line tool.
InsanelyMac Forum > Apple World > Mac Programming and Development
~pcwiz
I am trying to use the ioreg command line tool to get the data from:

IODeviceTree:/PCI0@0/AZAL@1B

So how would I use ioreg in Terminal to get just the info for that AZAL@1B?
stroke
ioreg -l | grep AZAL ?
~pcwiz
Thanks but that just gives me:

| +-o AZAL@1B <class IOPCIDevice, registered, matched, active, busy 0,$
| | | | "acpi-path" = "IOACPIPlane:/_SB/PCI0@0/AZAL@1b0000"

I actually need all the info from AZAL@1B to get the pin configurations and everything.

EDIT: See this is what I need"

CODE
+-o AZAL@1B  <class IOPCIDevice, registered, matched, active, busy 0,$
    | |   | | {
    | |   | |   "IOPCIResourced" = Yes
    | |   | |   "IOInterruptControllers" = ("io-apic-0","IOPCIMessagedInterrupt$
    | |   | |   "IOName" = "pci8086,293e"
    | |   | |   "subsystem-id" = <02a00000>
    | |   | |   "IOPCIExpressLinkCapabilities" = 0x0
    | |   | |   "IODeviceMemory" = (({"address"=0xfffffffff9200000,"length"=0x4$
    | |   | |   "layout-id" = <0c000000>
    | |   | |   "class-code" = <00030400>
    | |   | |   "IOPowerManagement" = {"ChildrenPowerState"=0x2,"CurrentPowerSt$
    | |   | |   "revision-id" = <02000000>
    | |   | |   "IOInterruptSpecifiers" = (<1600000007000000>,<0300000000000100$
    | |   | |   "assigned-addresses" = <10d8008200000000000020f9000000000040000$
    | |   | |   "built-in" = <00>
    | |   | |   "acpi-device" = "IOACPIPlatformDevice is not serializable"
    | |   | |   "device-id" = <3e290000>
    | |   | |   "vendor-id" = <86800000>
    | |   | |   "acpi-path" = "IOACPIPlane:/_SB/PCI0@0/AZAL@1b0000"
    | |   | |   "subsystem-vendor-id" = <58140000>
    | |   | |   "name" = "pci8086,293e"
    | |   | |   "IOPCIExpressLinkStatus" = 0x0
    | |   | |   "reg" = <00d800000000000000000000000000000000000010d80002000000$
    | |   | |   "compatible" = <706369313435382c6130303200706369383038362c32393$
    | |   | |   "PinConfigurations" = <104011011220010111600101141001013099a101$
    | |   | | }
    | |   | |


Problem is, I had to dump the entire ioreg to get that. I just need the AZAL@1B part.
MacUser2525
You may want to try the device you want in place of the display@0 I have in the following it seems to be close to what you need to get.

CODE
MacUser2525$ ioreg -p IODeviceTree -n display@0 -r
+-o display@0  <class IOPCIDevice, registered, matched, active, busy 0, retain 15>
   | {
   |   "IOPCIResourced" = Yes
   |   "IOInterruptControllers" = ("io-apic-0","IOPCIMessagedInterruptController")
   |   "IOName" = "display"
   |   "subsystem-id" = <10000000>
   |   "IODeviceMemory" = (({"address"=18446744073541779456,"length"=16777216}),({"address"=18446744$
   |   "class-code" = <00000300>
   |   "revision-id" = <a2000000>
   |   "IOChildIndex" = 1
   |   "assigned-addresses" = <1000018200000000000000f60000000000000001140001c200000000000000e000000$
   |   "model" = <"NVIDIA GeForce 8800 GT">
   |   "AAPL01,blackscreen-preferences" = <00000008>
   |   "AAPL,iokit-ndrv" = <e0021079>
   |   "name" = "display"
   |   "AAPL,backlight-control" = <00000000>
   |   "subsystem-vendor-id" = <42380000>
   |   "AAPL00,blackscreen-preferences" = <00000008>
   |   "AAPL,interrupts" = <1000000007000000>
   |   "reg" = <0000010000000000000000000000000000000000100001020000000000000000000000000000
0011400$
   |   "compatible" = <"pci3842,c801","pci10de,611","pciclass,030000">
   |   "AAPL,aux-power-connected" = <01000000>
   |   "VRAM,totalsize" = <00000020>
   |   "AAPL00,Coherency" = <02000000>
   |   "driver-ist" = <80f1d90a0100000080f1d90a0200000080f1d90a03000000>
   |   "AAPL,ndrv-interrupt-set" = "IONDRVInterruptSet is not serializable"
   |   "rom-revision" = <"3233">
   |   "NVDA,Features" = <ff024f05>
   |   "NVCAP" = <05000000000003000c0000000000000b00000000>
   |   "AAPL,EMC-Display-List" = <03000000000000000000000000000000061000001b920000000000000000000006$
   |   "NVDA,current-arch" = 146
   |   "IOPCIExpressLinkCapabilities" = 15618
   |   "NVDA,gart-width" = 64
   |   "NVKernelLoaded" = <01000000>
   |   "AAPL,gray-page" = <01000000>
   |   "saved-config" = <0b0830024f0500002100ac10a0190003027f90061a0430073000500038040300090008007c2$
   |   "rm_multiboard_capable" = <01000000>
   |   "IOPowerManagement" = {"ChildrenPowerState"=2,"CurrentPowerState"=2}
   |   "AAPL,gart-width" = 64
   |   "rm_board_number" = <00000000>
   |   "IOInterruptSpecifiers" = (<1000000007000000>,<0600000000000100>)
   |   "twinView-driver" = <0040bb1f>
   |   "IOPMIsPowerManaged" = Yes
   |   "IOHibernateState" = <00000000>
   |   "device-id" = <11060000>
   |   "vendor-id" = <de100000>
   |   "device_type" = <"NVDA,Parent">
   |   "AAPL,gray-value" = <c38c6400>
   |   "IOPCIExpressLinkStatus" = 4353
   |   "AAPL,ndrv-dev" = Yes
   | }
   |
   +-o NVDA,Display-A@0  <class IONDRVDevice, registered, matched, active, busy 0, retain 10>
   +-o NVDA,Display-B@1  <class IONDRVDevice, registered, matched, active, busy 0, retain 9>
~pcwiz
W00T thanks so much I think that did it biggrin.gif...but how do I get the data to be displayed in hex format? I tried -x but it didn't work...
MacUser2525
QUOTE(~pcwiz @ Jul 8 2008, 08:40 PM) *
W00T thanks so much I think that did it biggrin.gif ...but how do I get the data to be displayed in hex format? I tried -x but it didn't work...


Looks like it changes values to hex when I use it here from looking at the "AAPL,gart-width" = 0x40 and "IOPCIExpressLinkStatus" = 0x1101 among others for example.


CODE
MacUser2525$ ioreg -x -p IODeviceTree -n display@0 -r
+-o display@0  <class IOPCIDevice, registered, matched, active, busy 0, retain 15>
   | {
   |   "IOPCIResourced" = Yes
   |   "IOInterruptControllers" = ("io-apic-0","IOPCIMessagedInterruptController")
   |   "IOName" = "display"
   |   "subsystem-id" = <10000000>
   |   "IODeviceMemory" = (({"address"=0xfffffffff6000000,"length"=0x1000000}),({"address"=0xfffffff$
   |   "class-code" = <00000300>
   |   "revision-id" = <a2000000>
   |   "IOChildIndex" = 0x1
   |   "assigned-addresses" = <1000018200000000000000f60000000000000001140001c200000000000000e000000$
   |   "model" = <4e5649444941204765466f7263652038383030204754>
   |   "AAPL01,blackscreen-preferences" = <00000008>
   |   "AAPL,iokit-ndrv" = <e0021079>
   |   "name" = "display"
   |   "AAPL,backlight-control" = <00000000>
   |   "subsystem-vendor-id" = <42380000>
   |   "AAPL00,blackscreen-preferences" = <00000008>
   |   "AAPL,interrupts" = <1000000007000000>
   |   "reg" = <0000010000000000000000000000000000000000100001020000000000000000000000000000
0011400$
   |   "compatible" = <706369333834322c6338303100706369313064652c36313100706369636c6173732c30333030
$
   |   "AAPL,aux-power-connected" = <01000000>
   |   "VRAM,totalsize" = <00000020>
   |   "AAPL00,Coherency" = <02000000>
   |   "driver-ist" = <80f1d90a0100000080f1d90a0200000080f1d90a03000000>
   |   "AAPL,ndrv-interrupt-set" = "IONDRVInterruptSet is not serializable"
   |   "rom-revision" = <33323333>
   |   "NVDA,Features" = <ff024f05>
   |   "NVCAP" = <05000000000003000c0000000000000b00000000>
   |   "AAPL,EMC-Display-List" = <03000000000000000000000000000000061000001b920000000000000000000006$
   |   "NVDA,current-arch" = 0x92
   |   "IOPCIExpressLinkCapabilities" = 0x3d02
   |   "NVDA,gart-width" = 0x40
   |   "NVKernelLoaded" = <01000000>
   |   "AAPL,gray-page" = <01000000>
   |   "saved-config" = <0b0830024f0500002100ac10a0190003027f90061a0430073000500038040300090008007c2$
   |   "rm_multiboard_capable" = <01000000>
   |   "IOPowerManagement" = {"ChildrenPowerState"=0x2,"CurrentPowerState"=0x2}
   |   "AAPL,gart-width" = 0x40
   |   "rm_board_number" = <00000000>
   |   "IOInterruptSpecifiers" = (<1000000007000000>,<0600000000000100>)
   |   "twinView-driver" = <0040bb1f>
   |   "IOPMIsPowerManaged" = Yes
   |   "IOHibernateState" = <00000000>
   |   "device-id" = <11060000>
   |   "vendor-id" = <de100000>
   |   "device_type" = <4e5644412c506172656e74>
   |   "AAPL,gray-value" = <c38c6400>
   |   "IOPCIExpressLinkStatus" = 0x1101
   |   "AAPL,ndrv-dev" = Yes
   | }
   |
   +-o NVDA,Display-A@0  <class IONDRVDevice, registered, matched, active, busy 0, retain 10>
   +-o NVDA,Display-B@1  <class IONDRVDevice, registered, matched, active, busy 0, retain 9>
Superhai
Why don´t you just type man ioreg?
stroke
Actually, the ioreg manual is pretty much crap, I couldn't even figure out how to get it to work — I kept trying MacUser's suggestion (before), and it turned out it wasn't working because I forgot the -r. You'd think that requiring the -r would be pretty redundant if you already specified -n, or -k.
~pcwiz
QUOTE(stroke @ Jul 9 2008, 11:17 AM) *
Actually, the ioreg manual is pretty much crap, I couldn't even figure out how to get it to work — I kept trying MacUser's suggestion (before), and it turned out it wasn't working because I forgot the -r. You'd think that requiring the -r would be pretty redundant if you already specified -n, or -k.


Exactly. ioreg manual is completely messed up. It says -x turns values into hexadecimal but it turns some into hex and leaves the others as plain data values? blink.gif Actually it did work for me without the -r...

ioreg -p IODeviceTree -n AZAL@1B | grep subsystem-id

That returns this:

| | "subsystem-id" = <02a00000>

Funny thing is, if I add the -r like so:

ioreg -p IODeviceTree -n AZAL@1B -r | grep subsystem-id

It returns:

"subsystem-id" = <02a00000>

Which is basically the same as without the -r, except that you don't have the " | | " laugh.gif
MacUser2525
QUOTE(~pcwiz @ Jul 9 2008, 05:08 PM) *
Which is basically the same as without the -r, except that you don't have the " | | " laugh.gif


That part is not connected to ioreg it is grep doing what it supposed to do namely getting everything on the line that contains the grepped string in the output you fed to it. In the -r case you do not have the extra | | because you do not have the entire tree being grepped although for your example I still get an extra | and need to put a cut on it to get your output. Curiosity has definitely got the better of me now what are you needing/using this for??

CODE
MacUser2525$ ioreg -p IODeviceTree -n display@0 | grep subsystem-id
     | |   |   "subsystem-id" = <10000000>
MacUser2525$ ioreg -p IODeviceTree -n display@0 -r | grep subsystem-id
   |   "subsystem-id" = <10000000>
MacUser2525$ ioreg -p IODeviceTree -n display@0 -r | grep subsystem-id | cut -d "|" -f2
    "subsystem-id" = <10000000>
~pcwiz
QUOTE(MacUser2525 @ Jul 9 2008, 01:48 PM) *
That part is not connected to ioreg it is grep doing what it supposed to do namely getting everything on the line that contains the grepped string in the output you fed to it. In the -r case you do not have the extra | | because you do not have the entire tree being grepped although for your example I still get an extra | and need to put a cut on it to get your output. Curiosity has definitely got the better of me now what are you needing/using this for??

CODE
MacUser2525$ ioreg -p IODeviceTree -n display@0 | grep subsystem-id
     | |   |   "subsystem-id" = <10000000>
MacUser2525$ ioreg -p IODeviceTree -n display@0 -r | grep subsystem-id
   |   "subsystem-id" = <10000000>
MacUser2525$ ioreg -p IODeviceTree -n display@0 -r | grep subsystem-id | cut -d "|" -f2
    "subsystem-id" = <10000000>


Its for OSX86Tools--automated audio EFI string maker. It needs to get some hex values from IORegistry so that's why I needed it.
MacUser2525
QUOTE(~pcwiz @ Jul 10 2008, 12:34 AM) *
Its for OSX86Tools--automated audio EFI string maker. It needs to get some hex values from IORegistry so that's why I needed it.


Ah I see that makes sense now.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.