aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2023-04-10 10:34:00 +0100
committerMarc Zyngier <maz@kernel.org>2023-04-10 10:34:12 +0100
commitdb7ee8815f80d3a01e9c6e4cbd72b41be3a687d1 (patch)
tree0463c57b896b4f28d8d40b78216dfac8ccb58eb9
parent09a537c6bcdae8ddfbda54bc8c0ff4d749ec2ad9 (diff)
downloadcs-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.txt4
-rw-r--r--vdmtool.c22
2 files changed, 16 insertions, 10 deletions
diff --git a/README.txt b/README.txt
index a7ac2c3..22967ab 100644
--- a/README.txt
+++ b/README.txt
@@ -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.
diff --git a/vdmtool.c b/vdmtool.c
index f6a01a9..e7a6fe1 100644
--- a/vdmtool.c
+++ b/vdmtool.c
@@ -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;