diff options
author | Marc Zyngier <maz@kernel.org> | 2023-04-10 10:34:00 +0100 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2023-04-10 10:34:12 +0100 |
commit | db7ee8815f80d3a01e9c6e4cbd72b41be3a687d1 (patch) | |
tree | 0463c57b896b4f28d8d40b78216dfac8ccb58eb9 | |
parent | 09a537c6bcdae8ddfbda54bc8c0ff4d749ec2ad9 (diff) | |
download | cs-sw-db7ee8815f80d3a01e9c6e4cbd72b41be3a687d1.tar.gz |
Move break handling over to CDCcdc-break
Use the CDC break instead of the in-band hack.
Signed-off-by: Marc Zyngier <maz@kernel.org>
-rw-r--r-- | README.txt | 4 | ||||
-rw-r--r-- | vdmtool.c | 22 |
2 files changed, 16 insertions, 10 deletions
@@ -177,7 +177,6 @@ to the follwing dump: P0: Current port ^_ Escape character ^_ ^_ Raw ^_ - ^_ ^@ Send break ^_ ! DUT reset ^_ ^R Central Scrutinizer reset ^_ ^^ Central Scrutinizer reset to programming mode @@ -191,9 +190,6 @@ which is completely self explainatory, but let's expand on it anyway: - ^_ ^_ sends a raw ^_, just in case you really need it -- ^_ ^@ sends a break, which is useful if interacting with a Linux - console as you get the sysrq functionality. - - ^_ ! resets the Mac without any warning. Yes, this is dangerous, use with caution and only when nothing else will do. @@ -433,7 +433,6 @@ static void help(struct vdm_context *cxt) cprintf(cxt, "Current port\n" "^_ Escape character\n" "^_ ^_ Raw ^_\n" - "^_ ^@ Send break\n" "^_ ! DUT reset\n" "^_ ^R Central Scrutinizer reset\n" "^_ ^^ Central Scrutinizer reset to programming mode\n" @@ -446,6 +445,22 @@ static void help(struct vdm_context *cxt) vdm_contexts[i].hw ? "present" : "absent"); } +/* Break is handled as sideband data via the CDC layer */ +void tud_cdc_send_break_cb(uint8_t itf, uint16_t duration_ms) +{ + struct vdm_context *cxt; + + if (itf > CONFIG_USB_PD_PORT_COUNT) + return; + + cxt = &vdm_contexts[itf]; + + if (!cxt->hw) + return; + + uart_set_break(UART(cxt), !!duration_ms); +} + static bool serial_handler(struct vdm_context *cxt) { bool uart_active = false; @@ -480,11 +495,6 @@ static bool serial_handler(struct vdm_context *cxt) case 4: /* ^D */ cxt->verbose = !cxt->verbose; break; - case 0: /* ^@ */ - uart_set_break(UART(cxt), true); - sleep_ms(1); - uart_set_break(UART(cxt), false); - break; case '\r': /* Enter */ debug_poke(cxt); break; |