Using sceWlanGetEtherAddr the call worked for me the first time, however, subsequent calls now yield the following:
00:00:00:00:FFFFFF00:00
instead of
00:00:00:00:00:00
didn't use actual mac but I think you see what I mean. I did this also with the wlan sample and returns the same thing now.
LiQuiD8d
sceWlanGetEtherAddr error?
This is because you are outputing the string incorrectly... sceWlanGetEtherAddr fills in a 12-byte unsigned char array. To output it, doing:
should work.. if there are typos I'm sorry.
The problem is that you are inherintly converting one of the numbers into an int, and since the int isnt initialized except for the lowest two bytes, it contains garbage... sometimes 0xFFFFFFF, sometimes 0x00000... maybe sometimes 0xDEADBEEF... who knows. If you want to continue to treat them as ints, you can also do: (intvalue & 0xFF)
Code: Select all
char addr[12];
unsigned short* saddr = (unsigned short*)addr;
sceWlanGetEtherAddr(&addr);
sprintf(buffer, "%2X:%2X:%2X:%2X:%2X:%2X", saddr[0], saddr[1], saddr[2], saddr[3], saddr[4], saddr[5] );
The problem is that you are inherintly converting one of the numbers into an int, and since the int isnt initialized except for the lowest two bytes, it contains garbage... sometimes 0xFFFFFFF, sometimes 0x00000... maybe sometimes 0xDEADBEEF... who knows. If you want to continue to treat them as ints, you can also do: (intvalue & 0xFF)