From d0a703754f9dc65ee2f53f6c18dc419662647fc1 Mon Sep 17 00:00:00 2001 From: 173210 Date: Fri, 4 Apr 2014 14:01:59 +0900 Subject: [PATCH] fix for 6.60 --- netshell/main.c | 37 ++++++++++++++++++++++--------------- psplink/psplink.ini | 10 +++++----- psplink/shell.c | 43 +------------------------------------------ 3 files changed, 28 insertions(+), 62 deletions(-) diff --git a/netshell/main.c b/netshell/main.c index d61b47b..8ad6bde 100644 --- a/netshell/main.c +++ b/netshell/main.c @@ -43,6 +43,8 @@ void ttySetWifiHandler(PspDebugPrintHandler wifiHandler); int g_currsock = -1; int g_servsock = -1; +int g_size = 0; +char g_data[4096]; #define SERVER_PORT 10000 @@ -50,7 +52,12 @@ int wifiPrint(const char *data, int size) { if(g_currsock >= 0) { - sceNetInetSend(g_currsock, data, size, 0); + while(g_size) + { + sceKernelDelayThread(4096); + } + memcpy(g_data, data, size); + g_size = size; } return size; @@ -135,17 +142,21 @@ void start_server(const char *szIpAddr) while(1) { - readbytes = sceNetInetRecv(new, &data, 1, 0); - if(readbytes <= 0) - { - sceNetInetClose(new); - g_currsock = -1; - printf("Socket %d closed\n", new); - break; + if(g_size) { + if(sceNetInetSend(new, g_data, g_size, 0) < 0) + { + sceNetInetClose(new); + g_currsock = -1; + printf("Socket %d closed\n", new); + break; + } + g_size = 0; } - else + + readbytes = sceNetInetRecv(new, &data, 1, MSG_DONTWAIT); + if(readbytes >= 0) { - if((data == 10) || (data == 13)) + if ((data == 10) || (data == 13)) { if(pos > 0) { @@ -159,18 +170,14 @@ void start_server(const char *szIpAddr) g_currsock = -1; psplinkExitShell(); } - psplinkPrintPrompt(); } } else if(pos < (sizeof(cli) -1)) { cli[pos++] = data; } - else - { - /* Do nothing */ - } } + sceKernelDelayThread(4096); } } diff --git a/psplink/psplink.ini b/psplink/psplink.ini index a41e11a..23797d3 100644 --- a/psplink/psplink.ini +++ b/psplink/psplink.ini @@ -1,7 +1,7 @@ # Example psplink configuration file. # usbmass=[0 1] Enable USB mass storage. Set to 1 to enable automatically -usbmass=1 +usbmass=0 # usbhost=[0 1] Enable USB host file system. Set to 1 to enable automatically usbhost=0 @@ -18,7 +18,7 @@ pluser=1 resetonexit=1 # sioshell=[0 1] Specify whether to start up the sio shell -sioshell=1 +sioshell=0 # kprintf=[0 1] Specify that SIO should be used for kprintf only, setting sioshell # to 1 overrides this setting. @@ -26,10 +26,10 @@ kprintf=1 # wifi=[0..N] Specify wifi should be enabled, the number is the # configuration to use if > 0 -wifi=0 +wifi=1 # wifishell=[0 1] Specify whether to start up the wifi shell -wifishell=0 +wifishell=1 # usbshell=[0 1] Specify whether to start up the usb shell usbshell=0 @@ -61,7 +61,7 @@ consupcmd=cop0 # prompt=... Set the psplink shell prompt # There are some escape characters, mainly %d to print the current dir -prompt="%d> " +prompt=" %d> " # path=... Set the psplink shell path # Each path is separated by a semi-colon, you can specify up to around 128 characters diff --git a/psplink/shell.c b/psplink/shell.c index 94ebfab..803625b 100644 --- a/psplink/shell.c +++ b/psplink/shell.c @@ -88,10 +88,6 @@ static int g_currcli_pos = 0; static SceUID g_command_msg = -1; /* Thread ID for the command line parsing */ static SceUID g_command_thid = -1; -/* Semaphore to lock the cli */ -static SceUID g_cli_sema = -1; -/* Event flag to indicate the end of command parse */ -static SceUID g_command_event = -1; /* Indicates the name of the last module we loaded */ static char g_lastmod[32] = ""; /* Indicates we are in tty mode */ @@ -4174,7 +4170,7 @@ static int shellParseThread(SceSize args, void *argp) { msg->res = CMD_ERROR; } - sceKernelSetEventFlag(g_command_event, COMMAND_EVENT_DONE); + print_prompt(); } return 0; @@ -4185,37 +4181,14 @@ int psplinkParseCommand(char *command) u32 k1; int ret; CommandMsg msg; - SceUInt timeout = (10*1000*1000); k1 = psplinkSetK1(0); - ret = sceKernelWaitSema(g_cli_sema, 1, &timeout); - if(ret < 0) - { - printf("Error, could not wait on cli sema 0x%08X\n", ret); - return 1; - } - memset(&msg, 0, sizeof(msg)); msg.command = command; msg.res = 0; ret = sceKernelSendMbx(g_command_msg, &msg); - if(ret >= 0) - { - u32 result; - ret = sceKernelWaitEventFlag(g_command_event, COMMAND_EVENT_DONE, 0x21, &result, NULL); - if(ret >= 0) - { - ret = msg.res; - } - else - { - printf("Error waiting for parse event 0x%08X\n", ret); - ret = CMD_EXITSHELL; - } - } - sceKernelSignalSema(g_cli_sema, 1); psplinkSetK1(k1); return ret; @@ -4600,20 +4573,6 @@ int shellInit(const char *cliprompt, const char *path, const char *init_dir, con return -1; } - g_cli_sema = sceKernelCreateSema("PspLinkCliSema", 0, 1, 1, NULL); - if(g_cli_sema < 0) - { - printf("Error, couldn't create cli semaphore 0x%08X\n", g_cli_sema); - return -1; - } - - g_command_event = sceKernelCreateEventFlag("PspLinkCmdEvent", 0, 0, NULL); - if(g_command_event < 0) - { - printf("Error, couldn't create command event 0x%08X\n", g_command_event); - return -1; - } - if(strlen(startsh) > 0) { ret = sceKernelStartThread(g_command_thid, strlen(startsh)+1, (void*) startsh);