rndis waits for LWIPServer in thread.

This commit is contained in:
songyanguang 2024-08-20 10:11:27 +08:00
parent 72ceb7fd26
commit 3f80e39695
1 changed files with 12 additions and 6 deletions

View File

@ -37,7 +37,7 @@ int ipc_rndis_server_init(void *para)
/* IPC lwip client */
struct Session *g_session_lwip = NULL;
int ipc_lwip_client_init(void)
int ipc_lwip_client_init(void *para)
{
struct Session *session;
@ -46,10 +46,11 @@ int ipc_lwip_client_init(void)
printf("No memory to alloc for LWIPServer session\r\n");
return -ENOMEM;
}
if(connect_session(session, "LWIPServer", 4096) < 0) {
printf("connect LWIPServer session failed\n");
return -1;
while (connect_session(session, "LWIPServer", 4096) < 0) {
usb_osal_msleep(1000);
}
printf("connect LWIPServer session success.\r\n");
g_session_lwip = session;
return 0;
@ -63,12 +64,17 @@ int lwip_rndis_data_recv(void *dataptr, size_t len)
void ipc_rndis_init(void){
int tid;
int tid_client;
ipc_lwip_client_init();
tid = thread(ipc_rndis_server_init, "ipc_rndis_server", NULL);
if(tid < 0){
printf("create thread ipc_rndis_server failed.\r\n");
}
tid_client = thread(ipc_lwip_client_init, "ipc_rndis_lwip_client", NULL);
if(tid < 0){
printf("create thread ipc_rndis_server failed.\r\n");
}
}
static void usb_init(int id)
@ -93,7 +99,7 @@ int main(int argc, char* argv[])
return -EINVAL;
}
}
printf("usb3 id % init.\n", id);
printf("main usb3 id(%d) init.\r\n", id);
usb_init(id);
ipc_rndis_init();