u/cubernetes

`bind -x '"...": setsid kill -2 $$'` works but `bind -x '"...": kill -2 $$'` does not
▲ 2 r/bash

`bind -x '"...": setsid kill -2 $$'` works but `bind -x '"...": kill -2 $$'` does not

I'm stumbling over a behavior in bash that I don't 100% understand. The following doesn't work as expected:

bind -x '"\ex": kill -SIGINT $$'

I would expect this to behave pretty much identical to pressing Ctrl-C, which in a normal terminal in canonical mode would send a SIGINT to the foreground process group of the session associated with the controlling terminal, which is in the case of readline in bash is handled by an appropriate signal handler that aborts the current readline buffer and reprints the prompt. Because of stty echoctl, we should also see a ^C being printed by the terminal itself.

However, this is not what happens. Instead, when I type \ex (Alt-x or Meta-x), it deletes the current PS1 prompt string, does NOT print ^C, moves to a new line, and then prints a new PS1 prompt string. Visually, it looks like the current line was completely erased (basically what printf '\033[2K' would do) and then a new line is created. Running it multiple times creates a lot of empty whitespace. Functionally, it's identical to Ctrl-C, though, which makes sense.

The weird thing is, if I run the kill -SIGINT command from another terminal, OR I adjust the command to be setsid kill instead of just kill (I know that this calls /bin/kill instead of the bash builtin kill, but that's irrelevant to the matter), then it suddenly works exactly as expected, identical to pressing Ctrl-C.

Can someone explain exactly what is going on? Adding stty sane or stty echo echoctl before the kill didn't help, unfortunately. My guess is that in the "bind -x" execution context, the terminal characteristics are set to -echo -echoctl (and maybe some more), but then why doesn't stty sane/stty echo echoctl help it?

u/cubernetes — 1 day ago

Huawei SCP vs SSCP fast charge protocol abbreviations

Hi! I was just wondering what these fast charging protocols stand for. My current best guess is:

SCP: "Smart Charge Protocol" (Gen 1: 22.5W, Gen 2: 66W, later versions: 80W, 88W, 100W, 120W, 127W, see https://www.tinkervault.com/usb-fast-charging-protocols/huawei-fcp-scp)

SSCP: "Super Smart Charge Protocol" or "Super Slow Charge Protocol"

However, for SCP, I've also seen "Super Charge Protocol", or "SuperCharge Protocol" (without a space), but I think those are wrong (official Huawei page mentions "Smart Charge Protocol": https://consumer.huawei.com/en/accessories/supercharge-wireless-car-charger-max-50w/). I KNOW that Huawei calls their SCP protocol also just "SuperCharge", but my question is about what the 3 letters in SCP stands for. As far as I know, "SuperCharge" is basically synonymous to "SCP", but nonetheless SCP stands for "Smart Charge Protocol", I'm pretty certain.

And for SSCP, I actually have not found anything official at all regarding what it stands for. I know SCP came after FCP, and I suppose SSCP comes after SCP, but I don't really know what it is. One of the oldest English articles I found online was by ChargerLab in 2021: https://www.chargerlab.com/power-z-kt002-technical-support/.
Here they show that their Power-Z KT002 supports SSCP. There are plenty other USB testers that support the mysterious SSCP: https://www.amazon.it/-/en/HELPERS-Multimeter-Voltmeter-SuperVOOC-Activation/dp/B09BNVFS54.

Does anyone have any sources/clues what it stands for? It's not even listed in tinkervault (https://www.tinkervault.com/usb-fast-charging-protocols).

u/cubernetes — 16 days ago