I am working on a tool for jailbroken iDevices. This tool will be run on a mac OS 10.8. Here's what I would like to achieve: When i run the tool (preferably sh or py or some script) it should be able to detect if a Simulator is running or if an iPhone/iPad is connected? and list all such devices (real/virtual).
Any pointers or suggestions would be highly appreciated.
In order to detect a connected iPhone, check out this answer. Something like this:
$ system_profiler SPUSBDataType | grep iPhone
will detect whether an iPhone is connected or not (you probably need a different grep for iPads).
The full(er) output of that command, without the | grep iPhone
is:
iPhone:
Product ID: 0x12a8
Vendor ID: 0x05ac (Apple Inc.)
Version: 5.10
Serial Number: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Speed: Up to 480 Mb/sec
Manufacturer: Apple Inc.
Location ID: 0xfa120000 / 5
Current Available (mA): 500
Current Required (mA): 500
Extra Operating Current (mA): 500
So, depending on what you want your script's output to look like, you may need to use your favorite scripting language to parse the above content.
To detect the simulator, try something like this:
$ ps -A | grep "iPhone Simulator "
which yields:
501 12115 135 0 1:53AM ?? 0:06.12 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator -SessionOnLaunch NO
Without specific guidance on how the output should look, it's hard to give you more. As with any scripting task, you should write it in the language you're good at.
Hopefully, that's a start. Maybe others can build on this, or suggest alternatives.
I am working on a tool for jailbroken iDevices. This tool will be run on a mac OS 10.8. Here's what I would like to achieve: When i run the tool (preferably sh or py or some script) it should be able to detect if a Simulator is running or if an iPhone/iPad is connected? and list all such devices (real/virtual).
Any pointers or suggestions would be highly appreciated.
In order to detect a connected iPhone, check out this answer. Something like this:
$ system_profiler SPUSBDataType | grep iPhone
will detect whether an iPhone is connected or not (you probably need a different grep for iPads).
The full(er) output of that command, without the | grep iPhone
is:
iPhone:
Product ID: 0x12a8
Vendor ID: 0x05ac (Apple Inc.)
Version: 5.10
Serial Number: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Speed: Up to 480 Mb/sec
Manufacturer: Apple Inc.
Location ID: 0xfa120000 / 5
Current Available (mA): 500
Current Required (mA): 500
Extra Operating Current (mA): 500
So, depending on what you want your script's output to look like, you may need to use your favorite scripting language to parse the above content.
To detect the simulator, try something like this:
$ ps -A | grep "iPhone Simulator "
which yields:
501 12115 135 0 1:53AM ?? 0:06.12 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator -SessionOnLaunch NO
Without specific guidance on how the output should look, it's hard to give you more. As with any scripting task, you should write it in the language you're good at.
Hopefully, that's a start. Maybe others can build on this, or suggest alternatives.
0 commentaires:
Enregistrer un commentaire