From a336bec81bcb49860c1b1f4dc6c3de536eae3be4 Mon Sep 17 00:00:00 2001 From: Virgil_lai <414785686@qq.com> Date: Tue, 12 Dec 2023 09:14:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E6=88=90=E5=BE=97=E8=83=9C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84hid=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 13 ++++--- lib_xua/src/core/endpoint0/xua_endpoint0.c | 42 ++++++++++++---------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 2f83ba8f..6b4facc4 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -393,10 +393,10 @@ void XUA_Buffer_Ep(register chanend c_aud_out, #endif #ifdef PAWPAW_INOUTHID - XUD_SetReady_In(ep_hid, g_hidData_in, PAWPAW_CFG_HID_IN_BUFSIZE);// 上行 + XUD_SetReady_In(ep_hid, g_hidData_in, 5);// 上行 XUD_SetReady_Out(ep_hid_out,g_hidData_out);// 下行 -#endif //#ifdef PAWPAW_INOUTHID +#endif //#ifdef d while(1) { XUD_Result_t result; @@ -946,11 +946,14 @@ void XUA_Buffer_Ep(register chanend c_aud_out, #ifdef PAWPAW_INOUTHID case XUD_SetData_Select(c_hid, ep_hid, result): { - // debug_printf("HID IN\n"); - hid_Buffer_exchange(BUF_XMOS_PC,g_hidData_in); + // printf("HID IN\n"); + if( hid_Buffer_exchange(BUF_XMOS_PC,g_hidData_in)){ + } + XUD_SetReady_In(ep_hid, g_hidData_in, 5); + - XUD_SetReady_In(ep_hid, g_hidData_in, PAWPAW_CFG_HID_IN_BUFSIZE); + } break; diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 3354e5b5..833cd528 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -453,24 +453,20 @@ static unsigned char hidReportDescriptorPtr[] = { #ifdef PAWPAW_INOUTHID #define hidReportDescriptorLength (sizeof(hidReportDescriptorPtr)) static unsigned char hidReportDescriptorPtr[] = { - 0x05, 0x0c, // HID_USAGE_PAGE (Vendor Defined) - 0x09, 0x01, // USAGE (Undefined) - 0xa1, 0x01, // COLLECTION (Application) - // Report ID if any - 0x09, 0x02, // USAGE (Undefined) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, PAWPAW_CFG_HID_IN_BUFSIZE, // REPORT_COUNT (report_size) - 0x81, 0x02, // INPUT (Data,Var,Abs) - // Output - 0x09, 0x03, // USAGE (Undefined) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, PAWPAW_CFG_HID_OUT_BUFSIZE, // REPORT_COUNT (report_size) - 0x91, 0x02, // OUTPUT (Data,Var,Abs) - 0xc0 // END_COLLECTION + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) //dwj cp 长沙西鲸 + 0x09, 0x00, // USAGE (0) + 0xa1, 0x01, // COLLECTION (Application) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0xff, // LOGICAL_MAXIMUM (255) + 0x19, 0x01, // USAGE_MINIMUM (1) + 0x29, 0x05, // USAGE_MAXIMUM (8) -dwj + 0x95, 0x05, // REPORT_COUNT (8) -dwj + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x19, 0x01, // USAGE_MINIMUM (1) + 0x29, 0x05, // USAGE_MAXIMUM (8) -dwj + 0x91, 0x02, // OUTPUT (Data,Var,Abs) + 0xc0 // END_COLLECTION }; #endif //#ifdef PAWPAW_INOUTHID @@ -902,6 +898,16 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 result = HidInterfaceClassRequests(ep0_out, ep0_in, &sp); } #endif + +#ifdef PAWPAW_INOUTHID + if (interfaceNum == INTERFACE_NUMBER_HID) + { + debug_printf("INTERFACE_NUMBER_HID"); + extern XUD_Result_t HidInterfaceClassRequests_PAWPAW(XUD_ep c_ep0_out, XUD_ep c_ep0_in, USB_SetupPacket_t sp); + HidInterfaceClassRequests_PAWPAW(ep0_out, ep0_in, sp); + } +#endif//#ifdef PAWPAW_INOUTHID + /* Check for: - Audio CONTROL interface request - always 0, note we check for DFU first * - Audio STREAMING interface request (In or Out) * - Audio endpoint request (Audio 1.0 Sampling freq requests are sent to the endpoint)