Update to Hekate bdk 5.5.0, prelim Mariko support
This commit is contained in:
parent
04378b322d
commit
5d101cad50
89 changed files with 12779 additions and 2210 deletions
|
@ -22,6 +22,8 @@
|
|||
#include <gfx_utils.h>
|
||||
#include <input/joycon.h>
|
||||
#include <input/touch.h>
|
||||
#include <soc/hw_init.h>
|
||||
#include <soc/t210.h>
|
||||
#include <utils/util.h>
|
||||
|
||||
#include <memory_map.h>
|
||||
|
@ -67,6 +69,7 @@ typedef struct _jc_cal_t
|
|||
} jc_cal_t;
|
||||
|
||||
static jc_cal_t jc_cal_ctx;
|
||||
static usb_ops_t usb_ops;
|
||||
|
||||
static bool _jc_calibration(jc_gamepad_rpt_t *jc_pad)
|
||||
{
|
||||
|
@ -306,16 +309,16 @@ static bool _fts_touch_read(touchpad_report_t *rpt)
|
|||
|
||||
static u8 _hid_transfer_start(usb_ctxt_t *usbs, u32 len)
|
||||
{
|
||||
u8 status = usb_device_write_ep1_in((u8 *)USB_EP_BULK_IN_BUF_ADDR, len, NULL, true);
|
||||
|
||||
if (status == 26)
|
||||
u8 status = usb_ops.usb_device_ep1_in_write((u8 *)USB_EP_BULK_IN_BUF_ADDR, len, NULL, USB_XFER_SYNCED);
|
||||
if (status == USB_ERROR_XFER_ERROR)
|
||||
{
|
||||
usbs->set_text(usbs->label, "#C7EA46 Status:# Error EP IN");
|
||||
usbd_flush_endpoint(3);
|
||||
usbs->set_text(usbs->label, "#FFDD00 Error:# EP IN transfer!");
|
||||
if (usb_ops.usbd_flush_endpoint)
|
||||
usb_ops.usbd_flush_endpoint(USB_EP_BULK_IN);
|
||||
}
|
||||
|
||||
// Linux mitigation: If timed out, clear status.
|
||||
if (status == 3)
|
||||
if (status == USB_ERROR_TIMEOUT)
|
||||
return 0;
|
||||
|
||||
return status;
|
||||
|
@ -350,6 +353,12 @@ int usb_device_gadget_hid(usb_ctxt_t *usbs)
|
|||
u32 gadget_type;
|
||||
u32 polling_time;
|
||||
|
||||
// Get USB Controller ops.
|
||||
if (hw_get_chip_id() == GP_HIDREV_MAJOR_T210)
|
||||
usb_device_get_ops(&usb_ops);
|
||||
else
|
||||
xusb_device_get_ops(&usb_ops);
|
||||
|
||||
if (usbs->type == USB_HID_GAMEPAD)
|
||||
{
|
||||
polling_time = 8000;
|
||||
|
@ -363,21 +372,21 @@ int usb_device_gadget_hid(usb_ctxt_t *usbs)
|
|||
|
||||
usbs->set_text(usbs->label, "#C7EA46 Status:# Started USB");
|
||||
|
||||
if (usb_device_init())
|
||||
if (usb_ops.usb_device_init())
|
||||
{
|
||||
usbd_end(false, true);
|
||||
usb_ops.usbd_end(false, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
usbs->set_text(usbs->label, "#C7EA46 Status:# Waiting for connection");
|
||||
|
||||
// Initialize Control Endpoint.
|
||||
if (usb_device_ep0_initialize(gadget_type))
|
||||
if (usb_ops.usb_device_enumerate(gadget_type))
|
||||
goto error;
|
||||
|
||||
usbs->set_text(usbs->label, "#C7EA46 Status:# Waiting for HID report request");
|
||||
|
||||
if (usb_device_get_hid_report())
|
||||
if (usb_ops.usb_device_class_send_hid_report())
|
||||
goto error;
|
||||
|
||||
usbs->set_text(usbs->label, "#C7EA46 Status:# Started HID emulation");
|
||||
|
@ -400,11 +409,11 @@ int usb_device_gadget_hid(usb_ctxt_t *usbs)
|
|||
}
|
||||
|
||||
// Check for suspended USB in case the cable was pulled.
|
||||
if (usb_device_get_suspended())
|
||||
if (usb_ops.usb_device_get_suspended())
|
||||
break; // Disconnected.
|
||||
|
||||
// Handle control endpoint.
|
||||
usbd_handle_ep0_pending_control_transfer();
|
||||
usb_ops.usbd_handle_ep0_ctrl_setup();
|
||||
|
||||
// Wait max gadget timing.
|
||||
timer = get_tmr_us() - timer;
|
||||
|
@ -422,11 +431,11 @@ int usb_device_gadget_hid(usb_ctxt_t *usbs)
|
|||
goto exit;
|
||||
|
||||
error:
|
||||
usbs->set_text(usbs->label, "#C7EA46 Status:# Timed out or canceled");
|
||||
usbs->set_text(usbs->label, "#FFDD00 Error:# Timed out or canceled");
|
||||
res = 1;
|
||||
|
||||
exit:
|
||||
usbd_end(true, false);
|
||||
usb_ops.usbd_end(true, false);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue