Пример #1
0
/* Connect to ChipcardLab */
void connectChipcardLab(int verbose)
{
    if(verbose)
    {
        printf("==CONNECT==\n\r");
        printf("Note: You can change the serial port by altering the variable $port in %s.\n\r",CONFIG_FILE);
        printf("      If the connection fails or the program hangs, just powercycle your chipcardLab\n\r");
        printf("      and try again. If that does not help check the cabeling, if you use an USB to\n\r");
        printf("      serial port adaptor, try to avoid USB-Hubs. If PCSC or other programs that might\n\r");
        printf("      access serial ports, try to halt them and try again. Also make sure that a 16Mhz\n\r");
        printf("      crystal oscillator is plugged into the chipcardLab!\n\r");
        printf("\n\r");
        printf(" * Connecting Chipcardlab on %s with %s baud",configfilePortValue,configfileBaudrateValue);
    }

    ttyInit(configfilePortValue, atoi(configfileBaudrateValue));
    ttyClearBuffer(configfilePortValue);

    if(verbose)
    {
        printf(".");
        fflush(stdout);
    }
    sleep(1);

    if(verbose)
    {
        printf(".");
        fflush(stdout);
    }
    sleep(1);

    if(chipcardLabConnect() == 0)
    {
        if(verbose)
        {
            connected = true;
            printf("....\r\n");
            printf(" * Connection ok.\n\r");
        }
    }
    else
        printf("\n\r * Connection attempt failed!\n\r");

    return;
}
Пример #2
0
//-------------------------------------------------------------------------
int _start(int argc, char *argv[])
{
	// Init SMAP
	if (smap_init(&g_param.eth_addr_src[0]) != 0)
		return MODULE_NO_RESIDENT_END;

	// Does ARP request and wait reply to get server MAC address
	arp_init(&g_param);

#ifdef UDPTTY
	// Init UDP tty
	ttyInit(&g_param);
#endif

	// Init TCPIP layer 
	tcp_init(&g_param);

	tcp_connect();

	return MODULE_RESIDENT_END;
}
Пример #3
0
void initialise(SceSize args, void *argp)
{
	struct ConfigContext ctx;
	const char *init_dir = "host0:/";
	int (*g_sceUmdActivate)(int, const char *);
	int argc;
	char *argv[MAX_ARGS];

	memset(&g_context, 0, sizeof(g_context));
	map_firmwarerev();
	exceptionInit();
	g_context.thevent = -1;
	parse_sceargs(args, argp, &argc, argv);

	if(argc > 0)
	{
		char *lastdir;

		g_context.bootfile = argv[0];
		lastdir = strrchr(argv[0], '/');
		if(lastdir != NULL)
		{
			memcpy(g_context.bootpath, argv[0], lastdir - argv[0] + 1);
		}
	}

	configLoad(g_context.bootpath, &ctx);

	if(ctx.pid)
	{
		g_context.pid = ctx.pid;
	}
	else
	{
		g_context.pid = HOSTFSDRIVER_PID;
	}

	ttyInit();
	init_usbhost(g_context.bootpath);

#if _PSP_FW_VERSION >= 200
	if(argc > 1)
	{
		init_dir = argv[1];
	}
#else
	{
		struct SavedContext *save = (struct SavedContext *) SAVED_ADDR;
		if(save->magic == SAVED_MAGIC)
		{
			init_dir = save->currdir;
			save->magic = 0;
			g_context.rebootkey = save->rebootkey;
		}
	}
#endif

	if(shellInit(init_dir) < 0)
	{
		sceKernelExitGame();
	}

	g_sceUmdActivate = (void*) libsFindExportByNid(refer_module_by_name("sceUmd_driver", NULL), 
			"sceUmdUser", 0xC6183D47);
	if(g_sceUmdActivate)
	{
		g_sceUmdActivate(1, "disc0:");
	}

	/* Hook sceKernelExitGame */
	apiHookByNid(refer_module_by_name("sceLoadExec", NULL), "LoadExecForUser", 0x05572A5F, exit_reset);

	unload_loader();

	psplinkPatchException();

	if(ctx.enableuser)
	{
		load_psplink_user(g_context.bootpath);
	}

	g_context.resetonexit = ctx.resetonexit;

	sceKernelRegisterDebugPutchar(NULL);
	enable_kprintf(1);
	debugHwInit();
	modLoad(g_context.bootpath);
}