List of connected devices?
Hi all,
Is there an easy way do get a list of everything conneceted to a computer (i.e. usb/firewire drives/mice/keyboards/controllers/etc.)? Ideally, I'd like to be able to know everything about a machine including installed memory, video card, etc... How does the Apple System Profiler do all this? Thanks in advance,
thaeez
Is there an easy way do get a list of everything conneceted to a computer (i.e. usb/firewire drives/mice/keyboards/controllers/etc.)? Ideally, I'd like to be able to know everything about a machine including installed memory, video card, etc... How does the Apple System Profiler do all this? Thanks in advance,
thaeez
For USB, mice, keyboards, etc. use HID. Which will not be fun at all.
For the other stuff, no idea if there is any access to that information from the APIs.
For the other stuff, no idea if there is any access to that information from the APIs.
Huh. I used to have some code lying around that actually did that since I needed to figure that out for a project at work. A lot of it was built from sample code that I got from Apple's developer website. Poke around for stuff using IOKit. I'm pretty sure that's what the System Profiler uses.
Edit: On second thought, I'll just clean up what I have and make it available for download on my website.
Edit #2:
And here it is: http://www.malarkeysoftware.com/freecode.html
You could also call system_profiler from the command line with the -xml option and parse the xml output using TinyXML or the like.
Edit: On second thought, I'll just clean up what I have and make it available for download on my website.
Edit #2:
And here it is: http://www.malarkeysoftware.com/freecode.html
You could also call system_profiler from the command line with the -xml option and parse the xml output using TinyXML or the like.
The brains and fingers behind Malarkey Software (plus caretaker of the world's two brattiest felines).
Open a terminal, and type
Quote:system_profilerand be amazed!
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
I think he asked how does system_profiler do it..
Sir, e^iπ + 1 = 0, hence God exists; reply!
Hi all,
Thanks for your replies.
It looks like the sample code that Malarkey provided will work well for the general system information (thank you very much Malarkey - nice job!), but I still don't understand how I can get a list of USB / FireWire devices. It looks like the code at http://www.idevgames.com/forum/showthread.php?t=13336 might be useful, but I've never worked with HID and I don't understand it (usagePage? usage? huh?).
Any further suggestions on how I could get a list of attached devices (and their names)?
Thanks again for all your help...
thaeez
Thanks for your replies.
It looks like the sample code that Malarkey provided will work well for the general system information (thank you very much Malarkey - nice job!), but I still don't understand how I can get a list of USB / FireWire devices. It looks like the code at http://www.idevgames.com/forum/showthread.php?t=13336 might be useful, but I've never worked with HID and I don't understand it (usagePage? usage? huh?).
Any further suggestions on how I could get a list of attached devices (and their names)?
Thanks again for all your help...
thaeez
I don't think the HID stuff (which is mainly for keyboards, gamepads, etc.) will work for getting all USB / Firewire devices. Your best bet is to probably start here:
http://developer.apple.com/reference/Har...-date.html
And look through the sample code and references (assuming you haven't done so already). I'd also search through Apple's mailing list archives at:
http://lists.apple.com/archives/
Good luck!
http://developer.apple.com/reference/Har...-date.html
And look through the sample code and references (assuming you haven't done so already). I'd also search through Apple's mailing list archives at:
http://lists.apple.com/archives/
Good luck!
The brains and fingers behind Malarkey Software (plus caretaker of the world's two brattiest felines).
HID isnt mainly for keyboards, gamepads, etc, its for Human Interface Devices, and it will list all USB devices. I dont know about firewire though.
Sir, e^iπ + 1 = 0, hence God exists; reply!
As was said way back at the start, the IOKit will provide access to all devices. HID will only do USB HID (a subset of all USB) devices.
If I were attempting this, though, I'd be doing what Malarkey suggested -- getting System Profiler to output XML and parsing that, rather than dealing with the IOKit.
If I were attempting this, though, I'd be doing what Malarkey suggested -- getting System Profiler to output XML and parsing that, rather than dealing with the IOKit.
unknown Wrote:HID isnt mainly for keyboards, gamepads, etc, its for Human Interface Devices, and it will list all USB devices. I dont know about firewire though.
Well, using the code that I have that's based off of HID Utilities, it doesn't list my camera, iPod, or thumbdrive as a USB device so no, I don't think it will list every USB device attached.
Just to get back on topic, I came across this bit of sample code that sets up callbacks for when USB devices are added or removed:
http://developer.apple.com/samplecode/US...index.html
Might be handy for thaeez in figuring out what devices are currently attached.
The brains and fingers behind Malarkey Software (plus caretaker of the world's two brattiest felines).
[unrelated]
Woha!!!!
Another Mac game dev'er from my town in the middle of nowhere! (figuritavely speaking). That's pretty cool....
[/unrelated]
Woha!!!!
Another Mac game dev'er from my town in the middle of nowhere! (figuritavely speaking). That's pretty cool....
[/unrelated]
When in doubt ... read the Read Me
10.5.6 | MacBook Pro 2.5x2 | 4 GB RAM | GeForce 8600M GT
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Porting Help: Input Devices | gregorypierce | 6 | 3,650 |
Dec 29, 2002 05:44 AM Last Post: NCarter |
|

