summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-04-05 00:04:47 +0700
committerhathach <[email protected]>2022-04-05 00:04:47 +0700
commitd97c1546957059cfb3063b95d5287e2729f7f79a (patch)
treefd289e2b43c222ff87083b851b9a7c188cf186ea
parentd7d7e61f3437076a38ec031f2dc4cef38c8c831b (diff)
add need_pre for pio usb, but not work out well
m---------lib/Pico-PIO-USB0
-rw-r--r--src/host/usbh.c4
-rw-r--r--src/portable/raspberrypi/pio_usb/hcd_pio_usb.c6
3 files changed, 7 insertions, 3 deletions
diff --git a/lib/Pico-PIO-USB b/lib/Pico-PIO-USB
-Subproject 650ef75f0d8a4020a7ddc2ccee1ee0f3237ab76
+Subproject 4993f4a1df03c8af13c8091052a6274e8c333bc
diff --git a/src/host/usbh.c b/src/host/usbh.c
index c127ef310..47c462012 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -642,7 +642,7 @@ static bool usbh_control_xfer_cb (uint8_t dev_addr, uint8_t ep_addr, xfer_result
__attribute__((fallthrough));
case CONTROL_STAGE_DATA:
- if (xferred_bytes)
+ if (request->wLength)
{
TU_LOG2("[%u:%u] Control data:\r\n", rhport, dev_addr);
TU_LOG2_MEM(_ctrl_xfer.buffer, xferred_bytes, 2);
@@ -1301,7 +1301,7 @@ static void process_enumeration(tuh_xfer_t* xfer)
TU_ASSERT(new_dev, );
new_dev->addressed = 1;
- // TODO close device 0, may not be needed
+ // Close device 0
hcd_device_close(_dev0.rhport, 0);
// open control pipe for new address
diff --git a/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c b/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
index 839087957..c2ef54b9e 100644
--- a/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
+++ b/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
@@ -111,8 +111,12 @@ void hcd_int_disable(uint8_t rhport)
bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const * desc_ep)
{
+ hcd_devtree_info_t dev_tree;
+ hcd_devtree_get_info(dev_addr, &dev_tree);
+ bool const need_pre = (dev_tree.hub_addr && dev_tree.speed == TUSB_SPEED_LOW);
+
rhport = RHPORT_PIO(rhport);
- return pio_usb_endpoint_open(rhport, dev_addr, (uint8_t const*) desc_ep);
+ return pio_usb_endpoint_open(rhport, dev_addr, (uint8_t const*) desc_ep, need_pre);
}
bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t buflen)