Detecting hardware, which iPhone/iPod I'm running on?

Member
Posts: 129
Joined: 2009.03
Post: #1
I want to add extra visual effects if I'm running on more powerful hardware; i.e. iPod Touch 3G, or iPhone 3GS, or iPad (so anything that's not iPhone 2G/3G, or iPod Touch 2G).

Is it possible to determine which version of the iPhone or iPod Touch, or even iPad, that my app is running on?

Thanks,
Quote this message in a reply
Member
Posts: 129
Joined: 2009.03
Post: #2
Okay, got it, posting here, for anyone else who may be interested...

Code:
struct utsname systemInfo;
uname(&systemInfo);

I'm thinking, iPhone 2G and iPhone 3G are about the same in terms of processing power? Also, the original iPod Touch is equal to or less than iPhone 2G?

Is that correct?
Quote this message in a reply
Member
Posts: 81
Joined: 2007.07
Post: #3
a good resource of iphone hardware
http://en.wikipedia.org/wiki/List_of_iPhone_OS_devices

iPhone, 3G, iPod Touch - 412mhz, PowerVR MBX Lite 3D GPU
iPod Touch 2nd Gen - 532mhz, PowerVR MBX Lite 3D GPU
3GS, iPod Touch 3rd Gen - 600mhz, PowerVR SGX535 GPU
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #4
Since we're talking visual effects here, you could go by the available OpenGL ES version. The OpenGL ES Xcode template has an example that tries to create an ES2 context (kEAGLRenderingAPIOpenGLES2), and falls back to ES1 if you're not on hardware that supports ES2 (PowerVR SGX, the GPU in the iPhone 3GS, third-generation iPod Touch, and iPad).

Another way you can do it is to compile a universal binary with different code in armv7 than armv6, and put your fancier graphics in the armv7 code. All of the "fast" devices run armv7 and the "slow" devices don't, so the appropriate one will be launched when your app starts.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #5
Might want to fix up your summary Rasterman (iPhone 3G belongs in the first row, and the 3GS belongs in the last).

Also, that chart doesn't mention GPU clock speeds but I'm pretty sure the 2nd gen touch has got a souped up GPU too, 'cause OpenGL is more than just a little faster vs the 1st gen touch.
Quote this message in a reply
Member
Posts: 166
Joined: 2009.04
Post: #6
ThemsAllTook Wrote:Since we're talking visual effects here, you could go by the available OpenGL ES version. The OpenGL ES Xcode template has an example that tries to create an ES2 context (kEAGLRenderingAPIOpenGLES2), and falls back to ES1 if you're not on hardware that supports ES2 (PowerVR SGX, the GPU in the iPhone 3GS, third-generation iPod Touch, and iPad).

Another way you can do it is to compile a universal binary with different code in armv7 than armv6, and put your fancier graphics in the armv7 code. All of the "fast" devices run armv7 and the "slow" devices don't, so the appropriate one will be launched when your app starts.

I tend to check for the number of texture units .... most people don't realize it but even when running a common GLES 1.x path for all devices, there are vast differences between various devices in terms of GLES capabilities.
Quote this message in a reply
Member
Posts: 269
Joined: 2005.04
Post: #7
Jamie W Wrote:I'm thinking, iPhone 2G and iPhone 3G are about the same in terms of processing power? Also, the original iPod Touch is equal to or less than iPhone 2G?

Is that correct?

In terms of speed:

2nd-gen iPod touch > iPhone 3G > iPhone 2G > 1st-gen iPod touch

The difference between the two iPhones and the 1st-gen touch is relatively minor (a couple fps usually). The 2nd-gen touch can be quite a bit faster.
Quote this message in a reply
Moderator
Posts: 384
Joined: 2002.08
Post: #8
Yup, it would be better to, rather than simply query which version of hardware you're running on (you'll have to upgrade your app every time new hardware comes out), instead do some other test, like ThemsAllTook or warmi suggest.

KB Productions, Car Care for iPhone/iPod Touch
@karlbecker_com
All too often, art is simply the loss of practicality.
Quote this message in a reply
Member
Posts: 129
Joined: 2009.03
Post: #9
Well, I was going to do something where I check the hardware, and if it's iPhone, iPhone 3G, or iPod Touch 1G; assume it's slow; everything else (including any new devices to be introduced) assume it's fast.

Maybe it makes more sense to test for OpenGL ES 2.0 though. If that means the more powerful GPU is present, and I assume the GPU will affect performance a lot more that the CPU speed...

I wasn't aware that they used different version of the ARM chip, on different devices. Does this mean, I'm creating universal binaries anyway (with two lots of executable code, one for each version of the CPU)?

On the topic, do many people find the need to code directly in ARM (or Thumb?) asm on iPhone? and can we do that in Xcode?

Thanks,
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #10
Jamie W Wrote:Well, I was going to do something where I check the hardware, and if it's iPhone, iPhone 3G, or iPod Touch 1G; assume it's slow; everything else (including any new devices to be introduced) assume it's fast.
That's what I do (assuming "fast" means 2nd Gen iPod touch or better). Since there's no way to differentiate the 2nd gen touch from the 1st gen devices other than clock speed this seemed like a reasonable approach. I guess Apple could turn around and release a newer but slower device but if that happens I'm giving up. Rasp

Jamie W Wrote:Does this mean, I'm creating universal binaries anyway (with two lots of executable code, one for each version of the CPU)?
If you're targeting OS 3 or above you can build a UB by setting "Architectures" to "Optimized (armv6 armv7)" in the build settings. For games, you'll usually want to turn off Thumb for armv6, but leave it on for armv7. You can do this in the build settings by adding conditional settings to "Compile for Thumb".
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Mac hardware nagennaskar 9 6,720 Jul 4, 2011 08:23 AM
Last Post: OneSadCookie
  running Cocos2d IOS 3. apps on iPhone 4 aerospaceman 1 3,946 Dec 15, 2010 03:28 PM
Last Post: OneSadCookie
  Detecting MBX/SGX, 3G vs 3GS Bersaelor 1 2,914 Aug 12, 2010 08:50 AM
Last Post: arekkusu
  How much can I stuff in to video ram? (on iPhone/iPod touch) Jamie W 9 9,755 Aug 6, 2010 05:23 AM
Last Post: mariocaprino
  iPhone Only? Not for iPod Touch? daveh84 4 4,154 May 7, 2010 10:46 PM
Last Post: cmiller