0
0
Fork 0

fix: Fixed some rookie mistakes

This is a temporary "stable" release. See the Readme.md file in the root directory for more instructions.
This commit is contained in:
windowsair 2020-01-31 15:57:17 +08:00
parent 1070f63074
commit ad6b9b3609
12 changed files with 318 additions and 289 deletions

View File

@ -1,5 +1,7 @@
# Setup # Attention
1. DAP_Setup()
2. Server begin
# Loop At present, the adaptation to WCID, WinUSB, etc. has all been completed. However, when transmitting data on the endpoint, we received an error message from USBIP. This is most likely a problem with the USBIP project itself.
Due to the completeness of the USBIP protocol document, we have not yet understood its role in the Bulk transmission process, which may also lead to errors in subsequent processes.
We will continue to try to make it work under USB HID. Once the USBIP problem is solved, we will immediately transfer it to work under WinUSB

View File

@ -29,6 +29,7 @@
#define __DAP_CONFIG_H__ #define __DAP_CONFIG_H__
#include <stdint.h> #include <stdint.h>
#include <string.h>
#include "cmsis_compiler.h" #include "cmsis_compiler.h"
#include "gpio.h" #include "gpio.h"
#include "gpio_struct.h" #include "gpio_struct.h"
@ -153,8 +154,9 @@ __STATIC_INLINE uint8_t DAP_GetVendorString(char *str)
////TODO: fill this ////TODO: fill this
// In fact, Keil can get the corresponding information through USB // In fact, Keil can get the corresponding information through USB
// without filling in this information. // without filling in this information.
(void)str; // (void)str;
return (0U); strcpy(str, "windowsair");
return (sizeof("windowsair"));
} }
/** /**
@ -165,8 +167,9 @@ __STATIC_INLINE uint8_t DAP_GetVendorString(char *str)
*/ */
__STATIC_INLINE uint8_t DAP_GetProductString(char *str) __STATIC_INLINE uint8_t DAP_GetProductString(char *str)
{ {
(void)str; //(void)str;
return (0U); strcpy(str, "CMSIS-DAP v2");
return (sizeof("CMSIS-DAP v2"));
} }
/** /**
@ -177,8 +180,8 @@ __STATIC_INLINE uint8_t DAP_GetProductString(char *str)
*/ */
__STATIC_INLINE uint8_t DAP_GetSerNumString(char *str) __STATIC_INLINE uint8_t DAP_GetSerNumString(char *str)
{ {
(void)str; strcpy(str, "1234");
return (0U); return (sizeof("1234"));
} }
///@} ///@}

View File

@ -1,4 +1,2 @@
# TODO # TODO
1. adapt to special hardware 1. USB
2. USB
3. Significant Bit is difficult to judge, may need to dive into the details of usbip

View File

@ -19,6 +19,12 @@
#include "usb_defs.h" #include "usb_defs.h"
#include "MSOS20Descriptors.h" #include "MSOS20Descriptors.h"
const char *strings_list[] = {
0, // reserved: available languages
"windowsair",
"CMSIS-DAP v2",
"1234",
};
// handle functions // handle functions
static void handleGetDescriptor(usbip_stage2_header *header); static void handleGetDescriptor(usbip_stage2_header *header);
@ -192,7 +198,7 @@ static void handleGetDescriptor(usbip_stage2_header *header)
{ {
case USB_DT_DEVICE: // get device descriptor case USB_DT_DEVICE: // get device descriptor
os_printf("* GET 0x01 DEVICE DESCRIPTOR\r\n"); os_printf("* GET 0x01 DEVICE DESCRIPTOR\r\n");
send_stage2_submit_data(header, 0, kUSBd0DeviceDescriptor, sizeof(kUSBd0DeviceDescriptor)); send_stage2_submit_data(header, 0, &kUSBd0DeviceDescriptor[0], sizeof(kUSBd0DeviceDescriptor));
break; break;
case USB_DT_CONFIGURATION: // get configuration descriptor case USB_DT_CONFIGURATION: // get configuration descriptor
@ -223,9 +229,29 @@ static void handleGetDescriptor(usbip_stage2_header *header)
os_printf("** REQUESTED list of supported languages\r\n"); os_printf("** REQUESTED list of supported languages\r\n");
send_stage2_submit_data(header, 0, kLangDescriptor, sizeof(kLangDescriptor)); send_stage2_submit_data(header, 0, kLangDescriptor, sizeof(kLangDescriptor));
} }
else if (header->u.cmd_submit.request.wValue.u8lo != 0xee)
{
os_printf("low bit : %d\r\n", (int)header->u.cmd_submit.request.wValue.u8lo);
os_printf("high bit : %d\r\n", (int)header->u.cmd_submit.request.wValue.u8hi);
int slen = strlen(strings_list[header->u.cmd_submit.request.wValue.u8lo]);
int wslen = slen * 2;
int buff_len = sizeof(usb_string_descriptor) + wslen;
char temp_buff[256];
usb_string_descriptor *desc = (usb_string_descriptor *)temp_buff;
desc->bLength = buff_len;
desc->bDescriptorType = USB_DT_STRING;
for (int i = 0; i < slen; i++)
{
desc->wData[i] = strings_list[header->u.cmd_submit.request.wValue.u8lo][i];
send_stage2_submit_data(header, 0, (uint8_t *)temp_buff, buff_len);
}
}
else else
{ {
os_printf("***Unsupported operation***\r\n"); os_printf("low bit : %d\r\n", (int)header->u.cmd_submit.request.wValue.u8lo);
os_printf("high bit : %d\r\n", (int)header->u.cmd_submit.request.wValue.u8hi);
os_printf("***Unsupported String descriptor***\r\n");
} }
break; break;
@ -242,7 +268,7 @@ static void handleGetDescriptor(usbip_stage2_header *header)
break; break;
case USB_DT_DEVICE_QUALIFIER: case USB_DT_DEVICE_QUALIFIER:
os_printf("* GET 0x06 DEVICE QUALIFIER DESCRIPTOR"); os_printf("* GET 0x06 DEVICE QUALIFIER DESCRIPTOR\r\n");
usb_device_qualifier_descriptor desc; usb_device_qualifier_descriptor desc;
@ -252,13 +278,13 @@ static void handleGetDescriptor(usbip_stage2_header *header)
break; break;
case USB_DT_OTHER_SPEED_CONFIGURATION: case USB_DT_OTHER_SPEED_CONFIGURATION:
os_printf("GET 0x07 [UNIMPLEMENTED] USB_DT_OTHER_SPEED_CONFIGURATION"); os_printf("GET 0x07 [UNIMPLEMENTED] USB_DT_OTHER_SPEED_CONFIGURATION\r\n");
////TODO:UNIMPLEMENTED ////TODO:UNIMPLEMENTED
send_stage2_submit(header, 0, 0); send_stage2_submit(header, 0, 0);
break; break;
case USB_DT_INTERFACE_POWER: case USB_DT_INTERFACE_POWER:
os_printf("GET 0x08 [UNIMPLEMENTED] USB_DT_INTERFACE_POWER"); os_printf("GET 0x08 [UNIMPLEMENTED] USB_DT_INTERFACE_POWER\r\n");
////TODO:UNIMPLEMENTED ////TODO:UNIMPLEMENTED
send_stage2_submit(header, 0, 0); send_stage2_submit(header, 0, 0);
break; break;
@ -268,7 +294,7 @@ static void handleGetDescriptor(usbip_stage2_header *header)
send_stage2_submit_data(header, 0, bosDescriptor, sizeof(bosDescriptor)); send_stage2_submit_data(header, 0, bosDescriptor, sizeof(bosDescriptor));
break; break;
default: default:
os_printf("USB unknown Get Descriptor requested:%d", header->u.cmd_submit.request.wValue.u8lo); os_printf("USB unknown Get Descriptor requested:%d\r\n", header->u.cmd_submit.request.wValue.u8lo);
break; break;
} }
} }

View File

@ -25,7 +25,7 @@
const uint8_t kUSBd0DeviceDescriptor[0x12] = const uint8_t kUSBd0DeviceDescriptor[0x12] =
{ {
0x12, // bLength 0x12, // bLength
USB_DT_DEVICE, // bDescriptorType (constant) USB_DT_DEVICE, // bDescriptorType
USBShort(0x0210), // bcdUSB USBShort(0x0210), // bcdUSB
////TODO: Is it also available elsewhere? ////TODO: Is it also available elsewhere?
@ -34,14 +34,14 @@ const uint8_t kUSBd0DeviceDescriptor[0x12] =
0x00, // bDeviceSubClass 0x00, // bDeviceSubClass
0x00, // bDeviceProtocol 0x00, // bDeviceProtocol
USBD0_MAX_PACKET0, // Maximum packet size for default pipe. USBD0_MAX_PACKET0, // bMaxPacketSize0 Maximum packet size for default pipe.
USBShort(USBD0_DEV_DESC_IDVENDOR), // Vendor ID (VID). USBShort(USBD0_DEV_DESC_IDVENDOR), // idVendor Vendor ID (VID).
USBShort(USBD0_DEV_DESC_IDPRODUCT), // Product ID (PID). USBShort(USBD0_DEV_DESC_IDPRODUCT), // idProduct Product ID (PID).
USBShort(USBD0_DEV_DESC_BCDDEVICE), // Device Version BCD. USBShort(USBD0_DEV_DESC_BCDDEVICE), // bcdDevice Device Version BCD.
0x01, // Index of Manufacturer string identifier. 0x01, // iManufacturer Index of Manufacturer string identifier.
0x02, // Index of Product string identifier. 0x02, // iProduct Index of Product string identifier.
0x03 * USBD0_STR_DESC_SER_EN, // Index of Product serial number. 0x03 * USBD0_STR_DESC_SER_EN, // iSerialNumber Index of Product serial number.
0x01 // Number of configurations. 0x01 // bNumConfigurations Number of configurations.
}; };
@ -60,7 +60,7 @@ const uint8_t kUSBd0InterfaceDescriptor[0x1E]=
USB_DT_INTERFACE, // bDescriptorType USB_DT_INTERFACE, // bDescriptorType
USBD_CUSTOM_CLASS0_IF0_NUM, // bInterfaceNumber USBD_CUSTOM_CLASS0_IF0_NUM, // bInterfaceNumber
USBD_CUSTOM_CLASS0_IF0_ALT, // bAlternateSetting USBD_CUSTOM_CLASS0_IF0_ALT, // bAlternateSetting
0x03, // bNumEndpoints(we will use three endpoints) 0x03, // bNumEndpoints(we will use 3 endpoints)
// //
USBD_CUSTOM_CLASS0_IF0_CLASS, // bInterfaceClass USBD_CUSTOM_CLASS0_IF0_CLASS, // bInterfaceClass
USBD_CUSTOM_CLASS0_IF0_SUBCLASS, // bInterfaceSubClass USBD_CUSTOM_CLASS0_IF0_SUBCLASS, // bInterfaceSubClass
@ -91,7 +91,7 @@ const uint8_t kUSBd0InterfaceDescriptor[0x1E]=
USB_DT_ENDPOINT, // bDescriptorType USB_DT_ENDPOINT, // bDescriptorType
0x01, // bEndpointAddress 0x01, // bEndpointAddress
USB_ENDPOINT_ATTR_BULK, // bmAttributes USB_ENDPOINT_ATTR_BULK, // bmAttributes
USBShort(512), // wMaxPacketSize USBShort(512), // wMaxPacketSize
// We assume that it always runs in High Speed. // We assume that it always runs in High Speed.
0x00, // bInterval 0x00, // bInterval
@ -102,16 +102,17 @@ const uint8_t kUSBd0InterfaceDescriptor[0x1E]=
USB_DT_ENDPOINT, // bDescriptorType USB_DT_ENDPOINT, // bDescriptorType
0x81, // bEndpointAddress 0x81, // bEndpointAddress
USB_ENDPOINT_ATTR_BULK, // bmAttributes USB_ENDPOINT_ATTR_BULK, // bmAttributes
USBShort(512), // wMaxPacketSize USBShort(512), // wMaxPacketSize
0x00, // bInterval 0x00, // bInterval
/* Pysical endpoint 2 */ /* Pysical endpoint 2 */
// "Endpoint 3: Bulk In (optional) used for streaming SWO trace" Device -> PC // "Endpoint 3: Bulk In (optional) used for streaming SWO trace" Device -> PC
0x07, // bLength 0x07, // bLength
USB_DT_ENDPOINT, // bDescriptorType USB_DT_ENDPOINT, // bDescriptorType
0x82, // bEndpointAddress 0x82, // bEndpointAddress
USB_ENDPOINT_ATTR_BULK, // bmAttributes USB_ENDPOINT_ATTR_BULK, // bmAttributes
USBShort(512), // wMaxPacketSize USBShort(512), // wMaxPacketSize
0x00, // bInterval 0x00, // bInterval
@ -123,9 +124,8 @@ const uint8_t kUSBd0ConfigDescriptor[LENGTHOFCONFIGDESCRIPTOR] =
{ {
// Configuration descriptor header. // Configuration descriptor header.
0x09, // bLength -> 0x09?? may be ok... 1-23 0x09, // bLength
0x03, // bDescriptorType USB_DT_CONFIGURATION, // bDescriptorType
// constant, set to 0x03
USBShort((sizeof(kUSBd0InterfaceDescriptor)) + (LENGTHOFCONFIGDESCRIPTOR)), USBShort((sizeof(kUSBd0InterfaceDescriptor)) + (LENGTHOFCONFIGDESCRIPTOR)),
// wTotalLength // wTotalLength

View File

@ -12,7 +12,7 @@
#include "usbip_server.h" #include "usbip_server.h"
#include "DAP_handle.h" #include "DAP_handle.h"
#include "DAP.h" #include "DAP.h"
#include "esp_libc.h"
////TODO: Merge this ////TODO: Merge this
#define DAP_PACKET_SIZE 512 #define DAP_PACKET_SIZE 512
@ -30,16 +30,18 @@ void handle_dap_data_request(usbip_stage2_header *header)
data_in = &(data_in[sizeof(usbip_stage2_header)]); data_in = &(data_in[sizeof(usbip_stage2_header)]);
// Point to the beginning of the URB packet // Point to the beginning of the URB packet
dap_respond = DAP_ProcessCommand((uint8_t *)data_in, (uint8_t *)data_out); dap_respond = DAP_ProcessCommand((uint8_t *)data_in, (uint8_t *)data_out);
send_stage2_submit(header, 0, 0); handle_dap_data_response(header);
//send_stage2_submit(header, 0, 0);
} }
void handle_dap_data_response(usbip_stage2_header *header) void handle_dap_data_response(usbip_stage2_header *header)
{ {
if (dap_respond) if (dap_respond)
{ {
dap_respond = 0;
//os_printf("*** Will respond");
send_stage2_submit_data(header, 0, data_out, DAP_PACKET_SIZE);
//os_printf("*** Will respond");
send_stage2_submit_data(header, 0, data_out, (dap_respond & 0x0000FFFF));
dap_respond = 0;
//os_printf("*** RESPONDED ***"); //os_printf("*** RESPONDED ***");
} }
else else
@ -66,18 +68,19 @@ void handle_swo_trace_response(usbip_stage2_header *header)
} }
} }
// SWO Data Queue Transfer // SWO Data Queue Transfer
// buf: pointer to buffer with data // buf: pointer to buffer with data
// num: number of bytes to transfer // num: number of bytes to transfer
void SWO_QueueTransfer (uint8_t *buf, uint32_t num) { void SWO_QueueTransfer(uint8_t *buf, uint32_t num)
swo_data_to_send = buf; {
num_swo_data = num; swo_data_to_send = buf;
swo_trace_respond = 1; num_swo_data = num;
swo_trace_respond = 1;
} }
// SWO Data Abort Transfer // SWO Data Abort Transfer
void SWO_AbortTransfer (void) { void SWO_AbortTransfer(void)
//USBD_EndpointAbort(0U, USB_ENDPOINT_IN(2U)); {
////TODO: unlink might be useful ... //USBD_EndpointAbort(0U, USB_ENDPOINT_IN(2U));
////TODO: unlink might be useful ...
} }

View File

@ -34,6 +34,7 @@
extern void SWO_Thread(void *argument); extern void SWO_Thread(void *argument);
extern void usart_monitor_task(void *argument); extern void usart_monitor_task(void *argument);
extern void DAP_Setup(void);
/* FreeRTOS event group to signal when we are connected & ready to make a request */ /* FreeRTOS event group to signal when we are connected & ready to make a request */
static EventGroupHandle_t wifi_event_group; static EventGroupHandle_t wifi_event_group;
@ -136,6 +137,7 @@ void app_main()
ESP_ERROR_CHECK(nvs_flash_init()); ESP_ERROR_CHECK(nvs_flash_init());
initialise_wifi(); initialise_wifi();
wait_for_ip(); wait_for_ip();
DAP_Setup(); // DAP Setup
xTaskCreate(timer_create_task, "timer_create", 512, NULL, 10, NULL); xTaskCreate(timer_create_task, "timer_create", 512, NULL, 10, NULL);
xTaskCreate(tcp_server_task, "tcp_server", 4096, NULL, 5, NULL); xTaskCreate(tcp_server_task, "tcp_server", 4096, NULL, 5, NULL);

View File

@ -65,7 +65,7 @@ void tcp_server_task(void *pvParameters)
os_printf("Unable to create socket: errno %d\r\n", errno); os_printf("Unable to create socket: errno %d\r\n", errno);
break; break;
} }
os_printf("Socket created"); os_printf("Socket created\r\n");
int err = bind(listen_sock, (struct sockaddr *)&destAddr, sizeof(destAddr)); int err = bind(listen_sock, (struct sockaddr *)&destAddr, sizeof(destAddr));
if (err != 0) if (err != 0)
@ -73,7 +73,7 @@ void tcp_server_task(void *pvParameters)
os_printf("Socket unable to bind: errno %d\r\n", errno); os_printf("Socket unable to bind: errno %d\r\n", errno);
break; break;
} }
os_printf("Socket binded"); os_printf("Socket binded\r\n");
err = listen(listen_sock, 1); err = listen(listen_sock, 1);
if (err != 0) if (err != 0)
@ -81,7 +81,7 @@ void tcp_server_task(void *pvParameters)
os_printf("Error occured during listen: errno %d\r\n", errno); os_printf("Error occured during listen: errno %d\r\n", errno);
break; break;
} }
os_printf("Socket listening"); os_printf("Socket listening\r\n");
#ifdef CONFIG_EXAMPLE_IPV6 #ifdef CONFIG_EXAMPLE_IPV6
struct sockaddr_in6 sourceAddr; // Large enough for both IPv4 or IPv6 struct sockaddr_in6 sourceAddr; // Large enough for both IPv4 or IPv6
@ -89,82 +89,76 @@ void tcp_server_task(void *pvParameters)
struct sockaddr_in sourceAddr; struct sockaddr_in sourceAddr;
#endif #endif
uint32_t addrLen = sizeof(sourceAddr); uint32_t addrLen = sizeof(sourceAddr);
kSock = accept(listen_sock, (struct sockaddr *)&sourceAddr, &addrLen);
if (kSock < 0)
{
os_printf("Unable to accept connection: errno %d\r\n", errno);
break;
}
os_printf("Socket accepted");
while (1) while (1)
{ {
int len = recv(kSock, rx_buffer, 2047, 0); kSock = accept(listen_sock, (struct sockaddr *)&sourceAddr, &addrLen);
// Error occured during receiving if (kSock < 0)
if (len < 0)
{ {
os_printf("recv failed: errno %d\r\n", errno); os_printf("Unable to accept connection: errno %d\r\n", errno);
break; break;
} }
// Connection closed os_printf("Socket accepted\r\n");
else if (len == 0)
{ while (1)
os_printf("Connection closed\r\n");
break;
}
// Data received
else
{ {
int len = recv(kSock, rx_buffer, 2047, 0);
// Error occured during receiving
if (len < 0)
{
os_printf("recv failed: errno %d\r\n", errno);
break;
}
// Connection closed
else if (len == 0)
{
os_printf("Connection closed\r\n");
break;
}
// Data received
else
{
#ifdef CONFIG_EXAMPLE_IPV6 #ifdef CONFIG_EXAMPLE_IPV6
// Get the sender's ip address as string // Get the sender's ip address as string
if (sourceAddr.sin6_family == PF_INET) if (sourceAddr.sin6_family == PF_INET)
{ {
inet_ntoa_r(((struct sockaddr_in *)&sourceAddr)->sin_addr.s_addr, addr_str, sizeof(addr_str) - 1); inet_ntoa_r(((struct sockaddr_in *)&sourceAddr)->sin_addr.s_addr, addr_str, sizeof(addr_str) - 1);
} }
else if (sourceAddr.sin6_family == PF_INET6) else if (sourceAddr.sin6_family == PF_INET6)
{ {
inet6_ntoa_r(sourceAddr.sin6_addr, addr_str, sizeof(addr_str) - 1); inet6_ntoa_r(sourceAddr.sin6_addr, addr_str, sizeof(addr_str) - 1);
} }
#else #else
inet_ntoa_r(((struct sockaddr_in *)&sourceAddr)->sin_addr.s_addr, addr_str, sizeof(addr_str) - 1); inet_ntoa_r(((struct sockaddr_in *)&sourceAddr)->sin_addr.s_addr, addr_str, sizeof(addr_str) - 1);
#endif #endif
rx_buffer[len] = 0; // Null-terminate whatever we received and treat like a string switch (kState)
//os_printf("Received %d bytes from %s:\r\n", len, addr_str); {
// os_printf("%s", rx_buffer); case ACCEPTING:
switch (kState) kState = ATTACHING;
{
case ACCEPTING:
kState = ATTACHING;
break;
case ATTACHING: case ATTACHING:
attach(rx_buffer, len); attach(rx_buffer, len);
break; break;
case EMULATING: case EMULATING:
emulate(rx_buffer, len); emulate(rx_buffer, len);
break; break;
default:
os_printf("unkonw kstate!\r\n");
}
} }
// int err = send(sock, rx_buffer, len, 0);
// if (err < 0)
// {
// os_printf("Error occured during sending: errno %d\r\n", errno);
// break;
// }
} }
} // kState = ACCEPTING;
kState = ACCEPTING; if (kSock != -1)
if (kSock != -1) {
{ os_printf("Shutting down socket and restarting...\r\n");
os_printf("Shutting down socket and restarting...\r\n"); //shutdown(kSock, 0);
shutdown(kSock, 0); close(kSock);
close(kSock);
shutdown(listen_sock, 0); //shutdown(listen_sock, 0);
close(listen_sock); //close(listen_sock);
vTaskDelay(5); //vTaskDelay(5);
}
} }
} }
vTaskDelete(NULL); vTaskDelete(NULL);

View File

@ -53,7 +53,7 @@ int attach(uint8_t *buffer, uint32_t length)
os_printf("attach Unknown command: %d\r\n", command); os_printf("attach Unknown command: %d\r\n", command);
break; break;
} }
return 0; ////TODO: ... return 0;
} }
static int read_stage1_command(uint8_t *buffer, uint32_t length) static int read_stage1_command(uint8_t *buffer, uint32_t length)
@ -130,16 +130,15 @@ static void send_device_list()
static void send_device_info() static void send_device_info()
{ {
os_printf("Sending device info..."); os_printf("Sending device info...\r\n");
usbip_stage1_usb_device device; usbip_stage1_usb_device device;
strcpy(device.path, "/sys/devices/pci0000:00/0000:00:01.2/usb1/1-1"); strcpy(device.path, "/sys/devices/pci0000:00/0000:00:01.2/usb1/1-1");
strcpy(device.busid, "1-1"); strcpy(device.busid, "1-1");
device.busnum = htonl(1); device.busnum = htonl(1);
device.devnum = htonl(2); device.devnum = htonl(1);
device.speed = htonl(2); // what is this??? device.speed = htonl(3); // See usb_device_speed enum
//// TODO: 0200H for USB2.0
device.idVendor = htons(USBD0_DEV_DESC_IDVENDOR); device.idVendor = htons(USBD0_DEV_DESC_IDVENDOR);
device.idProduct = htons(USBD0_DEV_DESC_IDPRODUCT); device.idProduct = htons(USBD0_DEV_DESC_IDPRODUCT);
@ -211,7 +210,7 @@ static int read_stage2_command(usbip_stage2_header *header, uint32_t length)
} }
//client.readBytes((uint8_t *)&header, sizeof(usbip_stage2_header)); //client.readBytes((uint8_t *)&header, sizeof(usbip_stage2_header));
unpack((uint32_t *)&header, sizeof(usbip_stage2_header)); unpack((uint32_t *)header, sizeof(usbip_stage2_header));
return header->base.command; return header->base.command;
} }
@ -263,7 +262,7 @@ static void unpack(void *data, int size)
} }
/** /**
* @brief * @brief USB transaction processing
* *
*/ */
static int handle_submit(usbip_stage2_header *header) static int handle_submit(usbip_stage2_header *header)
@ -324,18 +323,18 @@ void send_stage2_submit(usbip_stage2_header *req_header, int32_t status, int32_t
{ {
req_header->base.command = USBIP_STAGE2_RSP_SUBMIT; req_header->base.command = USBIP_STAGE2_RSP_SUBMIT;
req_header->base.direction = !req_header->base.direction; req_header->base.direction = !(req_header->base.direction);
memset(&req_header->u.ret_submit, 0, sizeof(usbip_stage2_header_ret_submit)); memset(&(req_header->u.ret_submit), 0, sizeof(usbip_stage2_header_ret_submit));
req_header->u.ret_submit.status = status; req_header->u.ret_submit.status = status;
req_header->u.ret_submit.data_length = data_length; req_header->u.ret_submit.data_length = data_length;
pack(&req_header, sizeof(usbip_stage2_header)); pack(req_header, sizeof(usbip_stage2_header));
send(kSock, req_header, sizeof(usbip_stage2_header), 0); send(kSock, req_header, sizeof(usbip_stage2_header), 0);
} }
void send_stage2_submit_data(usbip_stage2_header *req_header, int32_t status, const void *const data, int32_t data_length) void send_stage2_submit_data(usbip_stage2_header *req_header, int32_t status, const uint8_t *const data, int32_t data_length)
{ {
send_stage2_submit(req_header, status, data_length); send_stage2_submit(req_header, status, data_length);

View File

@ -13,6 +13,8 @@
#define EXAMPLE_WIFI_SSID "DAP" #define EXAMPLE_WIFI_SSID "DAP"
#define EXAMPLE_WIFI_PASS "12345678" #define EXAMPLE_WIFI_PASS "12345678"
#define PORT 22350 #define PORT 3240
#define CONFIG_EXAMPLE_IPV4 1
#endif #endif