[futurebasic] Re: [FB] Detecting Powerbooks

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1999 : Group Archive : Group : All Groups

From: "Pete" <furbies@...>
Date: Thu, 27 May 1999 09:22:31 +1000
>> Is there an easy way of detecting whether a program is running
>> on a Powerbook (without knowing about the various model number
>> gestalts (or whetever they're called))?
>
> Paul Bruneau <paul_bruneau@...> wrote:
>>Isn't this exactly what the gestalt system is for?
>
> Robert Covington wrote:
>>Would have gestalt so, wouldn't ya? :)
>>Andy, do you mean getting the knowledge that it is a Powerbook without
>>knowing the gestalt code for the machine?
>>I think you need to have some knowledge of the returned codes' exact
>>meanings/mapings, unless there is additional info returned for Powerbook
>>models that you could use, like a "PBK" or something. :)
>>Should be something at devworld.apple.com (I think) listing the various
> codes.
>
>
> Robert,
> You've got it in one! As I understand it there's dozens of model
> number Gestalt codes and it's expanding all the time...
> I just want a means (hey, Gestalt is fine if its generic enough)
> that'll give me a yes-no answer: Powerbook or not.
>
> I'll mosey on over to devworld.apple.com and have a look -
> as per your suggestion, Robert.
>
> Andy

There might be a way...

It depends on the fact that powerbooks are able to cycle down their CPU
speed, which as far as I know only power books can do.

(Don't quote me on this though)

Pete...


'Gestalt FN from ArielMars@...

LOCAL MODE
DIM selector&, gestaltResponse&
LOCAL FN scrollGestaltFN(selector&, gestaltResponse&)
  `  subq.l #2,sp
  ` move.l  ^selector&,-(sp)
  ` move.l  ^gestaltResponse&,-(sp)
  MACHLG &225F
  MACHLG &201F
  MACHLG &A1AD
  MACHLG &2288
  MACHLG &3E80
  ` move.w  (sp)+,D0
  ` ext.l   D0
END FN


isPowerBook% = _false
DIM gestaltResponse&
LONG IF FN scrollGestaltFN(_Gestaltpowermgrattr, @gestaltResponse&) = _noErr
  LONG IF (gestaltResponse& AND _GestaltPmgrExists) = _false
    REM Power manager Exists
    LONG IF (gestaltResponse& AND _GestaltPmgrCPUidle)  REM The CPU can idle
        isPowerBook% = _true
    END IF
  END IF
END IF