Welcome! Log In Create A New Profile



Posted by WiiGent 
March 07, 2009 01:55PM

I'm a complete n00b when it comes to coding for the Wii, but I do have a lot of java experience and a little C++ experience.
Now, I'm trying to grab the mac address of the wii, instead of having the user input it (I'm working on making a Mii editor for the Wii, which among other things will let you import foreign Miis as local Miis, this way you don't have to transfer Miis between you computer and the Wii to edit, or unlock the Mii).

Now, most of the code I've managed to grab from libogc, so I know that the I've created the HID heap properly and opened the ncd_manage FD properly.
The problem lies in the IOS_IoctlvFormat always returning error 4 (or -4 if you're picky), which happens to be an unknown error.
Still, I've tried it with a pointer to an unsigned 64-bit integer and to two unsigned 32-bit integers:

s32 retval = IOS_IoctlvFormat(hid, fd, 4, "q", pointerToMacAddr);


s32 retval = IOS_IoctlvFormat(hid, fd, 4, "dd", pointerToOui, pointerToNic);

Where pointerToMacAddr is a u64* pointer and pointerToOui and pointerToNic are u32* pointers.
The retval is always -4.
According to the wiki: [www.wiibrew.org]
the NCDGetWirelessMacAddress function outputs to two 32-bit integers, the only alternative I can see is a single 64-bit output, but neither works.

Does anyone have any idea here?
Either there is something wrong with the wiki docs for /dev/net/ncd/manage or I've completely misunderstood something about how IOS_IoctlvFormat works.
Re: NCDGetWirelessMacAddress
June 19, 2010 06:17PM
Sorry for raising the dead from the ground...

I was able to get the first 4 bytes of the mac address using below... now trying to figure out why the rest never comes...

	static u32 buf[0x08] ATTRIBUTE_ALIGN(32);
	static u32 macBuffer[0x02] ATTRIBUTE_ALIGN(32);

	retval=IOS_IoctlvFormat(__net_hid, wd_fd, 8, ":dd", buf, 0x20, macBuffer, 0x06);

ps: sending bigger buffers & lengths work but the rest of the mac address is not returned.. I've tried that...

edit: nevermind, I got it changing the format string to ":dq"... it sucks that there is no information about this anywhere even in the source code where it's implemented :[devkitpro.svn.sourceforge.net]

Edited 3 time(s). Last edit at 06/19/2010 06:53PM by I.R.on.
Re: NCDGetWirelessMacAddress
December 18, 2010 11:45AM
Someone asked me how to get the mac address so it's better I share the code here too..

Re: NCDGetWirelessMacAddress
December 19, 2010 01:47AM
There's already a function to do this in libogc (net_get_mac_address).
Re: NCDGetWirelessMacAddress
December 19, 2010 01:14PM
There's already a function to do this in libogc (net_get_mac_address).

I'm sure it's added recently though, I don't give a chance that I've missed it 5 months ago...
Re: NCDGetWirelessMacAddress
December 19, 2010 02:15PM
3 months ago, but my point was that it's easier to use an existing function than implement yours (which leaks the created heap...)
Re: NCDGetWirelessMacAddress
December 20, 2010 11:28AM
Well freeing that memory definitely unneeded where I've used it... Yes indeed it leaks memory...

Working with heap actually one always get more problems freeing memory rather than leaking it due to buggy libraries underneath though...
Sorry, only registered users may post in this forum.

Click here to login