#define STATUS_UNKNOWN  0xFFFFFFFF

/* UInt32 headphonesStatus(void)

        return hadphones inserted status. This status is either 0 or 1,
depending on insertion state
        and differs beteween devices (for some 1 = inserted, for some 0 =
inserted). Only works on
        TX, T5, LD, TC, and Z31. If something fails, returns STATUS_UNKNOWN.
        
        Will only work as 68k code, will not work in arm mode, hos no 
sideeffects
*/

UInt32 headphonesStatus(void){
        
        UInt32 dev,v;
        
        if(errNone != FtrGet(sysFtrCreator,sysFtrNumOEMDeviceID,&dev)) return
STATUS_UNKNOWN;
        
        switch(dev){
                
                case 'TnT5':
                case 'D050':    dev = 107; break;
                case 'TunX':    dev =  13; break;
                case 'MT64':    dev =   2; break;
                case 'Zi22':    dev =  12; break;
                default: return STATUS_UNKNOWN;
        }
        
        return ((*(UInt32*)(0x90E00000 + ((dev >> 5) << 2))) >> ((24 - (dev &
24)) + (dev & 7))) & 1;
}

On 8/27/08, Christopher Stamper <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 27, 2008 at 4:02 PM, Dmitry Grinberg <[EMAIL PROTECTED]> wrote:
>
> >
> >
> >
> > You can detect it by polling easily :)
>
> Nice idea... :-)
>
> Ryan, if you ever make it,  I'd really be interested. I've been wanting
> something that cam do this...
>
> --
> Christopher Stamper
>
> Email: [EMAIL PROTECTED]
> Web: http://tinyurl.com/2ooncg
> gTalk: http://tinyurl.com/6e359r
>  Skype: cdstamper
>
>  --
> For information on using the ACCESS Developer Forums, or to unsubscribe,
> please see http://www.access-company.com/developers/forums/
>


-- 
----
Best Regards,
Dmitry Grinberg
(847) 226 9295

-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to