Dave the following is a portion of code I am using which was basically lifted from the example found in the companion book:

If it is working for you then I'm sure I'm doing something stupid here. Please let me know.

char* getSerialNum(char *noNumberMessage)
{
        Char* bufP, checksumStr[2];
        UInt16 bufLen;
        Err retval;
        Int16 count, count1;
        UInt8 checkSum;

        // holds the dash and the checksum digit
        bufP = NULL;
        retval = SysGetROMToken(0, sysROMTokenSnum, (UInt8**) bufP, &bufLen);
        if((!retval) && (bufP) && ((UInt8) *bufP != 0xff))
        {
                //there's a valid serial number
                // Calculate the checksum: Start with zero add each digit.
                // then rotate the result onebit to the left and repeat.
                checkSum = 0;
                count1 = bufLen;
                for(count=0; count<count1; count++)
                {
                        checkSum += bufP[count];
                        checkSum = (checkSum<<1) | ((checkSum & 0x80) >> 7);
                }
                // Add the two hex digits (nibbles) together, +2
                // (range: 2-31 ==> 2-9, A-W)
                // By adding 2 to the result before converting to ASCII
                // we eliminate the numbers 0 and 1, which can be
                // difficult to distinguish from the letters 0 and I.
                checkSum = ((checkSum>>4) & 0x0f) + (checkSum & 0x0f) + 2;
                StrNCopy(Output, bufP, bufLen);
                //x += FntCharsWidth(bufP, bufLen);

// draw the dash and the checksum digit right after it
checksumStr[0] = '-';
checksumStr[1] = ((checkSum < 10) ? (checkSum + '0'):(checkSum - 10 +'A'));
StrNCat(Output, checksumStr, 2);
}
else
{
//there's no serial number
// Output a status message if the caller provided one
StrCopy(Output, noNumberMessage);
}
return(Output);
}


I've tried this on about 5 different machines from a IIIC to a Zaire and I always get nothing returned. Any help would be appreciated.

glg


-----------




At 01:55 PM 7/25/03 -0400, you wrote:
Use it all the time without problems.  How are you using it?  Although, not
all units have an electronic serial number.  Only units with Flash ROM.
Could that be the problem?

----- Original Message -----
From: "Gary Globus" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Friday, July 25, 2003 1:04 PM
Subject: Using the SysGetRomToken function to retrieve the serial number


> > I have tried using this function and have even downloaded the code example > given in the Companion manual. On all Palm devices that I have tried this > on I get no return value even though I can get an actual number through the > operating system screen menu. The question is has anyone used this function > successfully to retrieve the serial number or is there a better way to get > this say in assembler code? If anyone has used it successfully I'd > appreciate a snippet of the code so I can see what it is that I am doing wrong. > > > > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ >


--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/



-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to