Changes

Jump to navigation Jump to search
5,292 bytes added ,  07:43, 14 August 2008
UsbGecko to finnish
{{trans|finnish|english}}
USB Gecko on Wii/Gamecube -kehitys ja hakkerointi työkalu, joka yhdistetään tietokoneen USB-porttiin ja gamecube muistikorttiväylään Wiissä. Sitä voidaan käyttää; lähettämään homebrewiä konsolin, käyttää tietokonetta etänä [[Homebrew_apps/Wii_Linux|Wii Linuxin]] avulla ja [[Debugging|etä-virheen-korjaus]] työkaluna. Lisätietoa sivulla [http://www.usbgecko.com USB Gecko kotisivu] (englanniksi).

Koodi jota tervitset tietokoneellasi:

* Windows: : [http://www.ftdichip.com/Drivers/D2XX.htm API] [http://www.ftdichip.com/Documents/ProgramGuides/D2XXPG34.pdf DOC]

* Linux : [http://www.intra2net.com/de/produkte/opensource/ftdi/ API] [http://www.intra2net.com/de/produkte/opensource/ftdi/documentation/group__libftdi.html DOC]


Olen kokeillut linux-ohjelmaa, kaikki näyttää olevan ok, paitsi ftdi_read_data palauttaa aina 0.

<source lang="c">
#include <stdio.h>
#include <sys/types.h>
#include <ftdi.h>

//-------------------------- Globals ----------------------------------
int32_t status;
int ret;
int32_t TxSent;
int32_t RxSent;

struct ftdi_context ftdic;

int cmd_readmem = 0x04;
//-------------------------- Function Prototypes ----------------------------------
void gecko_opendevice();




int main(int argc, char **argv)
{
void* plop;
unsigned char responseback = 0;

ftdi_init(&ftdic);


printf("-----------------------------------\n");
printf("- NoNameNo's UsbGecko Linux Tools -\n");
printf("-----------------------------------\n\n");

gecko_opendevice();
printf("Connecting to Wii.\n");
printf("%x\n",gecko_writebyte(&cmd_readmem,1));
printf("%x\n",gecko_readbyte(&responseback, 1));
ftdi_usb_close(&ftdic);
ftdi_deinit(&ftdic);

return EXIT_SUCCESS;
}
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
int gecko_readbyte(unsigned char* lpBuffer, int dwBytesToRead)
{
status = ftdi_read_data(&ftdic, lpBuffer, dwBytesToRead);

if (status > 0){
if(status != dwBytesToRead){
return 2;
}
}
else{
printf("[Error] UsbGecko Reading Device\n");
//ftdi_usb_close(&ftdic);
//ftdi_deinit(&ftdic);
return status;
}

return 1;
}

//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
int gecko_writebyte(unsigned char* lpBuffer, int dwBytesToWrite)
{
status = ftdi_write_data(&ftdic, lpBuffer, dwBytesToWrite);

if (status > 0){
if(status != dwBytesToWrite){
return 2;
}
}
else{
printf("[Error] UsbGecko Writing Device\n");
ftdi_usb_close(&ftdic);
ftdi_deinit(&ftdic);
return 0;
}

return 1;
}



//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
void gecko_opendevice()
{
//---------------------------open device --------------------------------------
if((ret = ftdi_usb_open(&ftdic, 0x0403, 0x6001)) < 0) {
printf("[Error] UsbGecko NOT Detected\n");
exit(0);
}
else{
printf("[OK] UsbGecko Detected\n");
}


//---------------------------Reset device --------------------------------------
if((ret = ftdi_usb_reset(&ftdic)) < 0) {
printf("[Error] UsbGecko Reseting Device \n");
ftdi_usb_close(&ftdic);
ftdi_deinit(&ftdic);
exit(0);
}
else{
printf("[OK] UsbGecko Reseted\n");
}


//---------------------------SetTimeOut to 2000 --------------------------------------
ftdic.usb_read_timeout=2000;
ftdic.usb_write_timeout=2000;
printf("[OK] UsbGecko Setted 2 sec timout\n");

//---------------------------Purging RX/TX buffers --------------------------------------
if((ret = ftdi_usb_purge_buffers(&ftdic)) < 0) {
printf("[Error] UsbGecko Purging Buffer \n");
ftdi_usb_close(&ftdic);
ftdi_deinit(&ftdic);
exit(0);
}
else{
printf("[OK] UsbGecko Purged RX/TX buffers\n");
}



//--------------------------- Set RX/TX size buffer --------------------------------------
if((ret = ftdi_read_data_set_chunksize(&ftdic,65536)) < 0) {
printf("[Error] UsbGecko Setting RX buffer size\n");
ftdi_usb_close(&ftdic);
ftdi_deinit(&ftdic);
exit(0);
}
else{
printf("[OK] UsbGecko Setted RX Buffer Size\n");
}
if((ret = ftdi_write_data_set_chunksize(&ftdic,65536)) < 0) {
printf("[Error] UsbGecko Setting TX Buffer size\n");
ftdi_usb_close(&ftdic);
ftdi_deinit(&ftdic);
exit(0);
}
else{
printf("[OK] UsbGecko Setted TX Buffer Size\n");
}


//---------------------------Required ??? --------------------------------------
sleep(1);

}
</source>
[[Category:finnish pages]]
59

edits

Navigation menu