forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sceWlanGetEtherAddr error?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
liquid8d



Joined: 30 Jun 2005
Posts: 66

PostPosted: Mon Sep 19, 2005 10:44 am    Post subject: sceWlanGetEtherAddr error? Reply with quote

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
Back to top
View user's profile Send private message AIM Address
CyberBill



Joined: 26 Jul 2005
Posts: 86
Location: Redmond, WA

PostPosted: Wed Sep 21, 2005 5:14 pm    Post subject: Reply with quote

This is because you are outputing the string incorrectly... sceWlanGetEtherAddr fills in a 12-byte unsigned char array. To output it, doing:

Code:

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] );


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)
Back to top
View user's profile Send private message AIM Address MSN Messenger
jsgf



Joined: 12 Jul 2005
Posts: 254

PostPosted: Thu Sep 22, 2005 8:22 am    Post subject: Reply with quote

Actually, it just looks like sign-extension, rather than uninitialized stuff. The original poster's example is misleading, because they replaced the MAC address with all 0s; the example should read ffffff80 (or something). If you use an unsigned char [] for the mac address, it should be OK.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group