So I thought I had everything one needs to send key-events over USB-C to any device as I see fit. I have loaded what I think are the necessary kernel modules and have even implemented some Raspbian specific requirements just to test my luck. The first device I tried to send keyboard events to was my ZTE ZMAX Pro phone. It is running Android 6.0, so I figure keyboard support is a thing. However, when I try to send events to /dev/hidg0, I get:
$this->bbcode_second_pass_code('', 'BrokenPipeError: [Errno 108] Cannot send after transport endpoint shutdown')
This doesn't seem to be a very google-able error. What's more strange is that this error message changes when I plug the RasPi into to a different device and then plug the phone in once again. (I think I should also note here that I'm supplying power to my RasPi over GPIO not the USB-C). I get this error message:
$this->bbcode_second_pass_code('', 'BlockingIOError: [Errno 11] write could not complete without blocking')
Again, the keyboard gadget works, but not with this phone. I find this strange because the NetHunter phone (a phone with Kali installed and able to function as a gadget) provides this functionality out of the box and it just works. There is an entire github repo devoted to pin cracking based on this functionality: https://github.com/urbanadventurer/Android-PIN-Bruteforce
Now, this might be something specific to my phone, but on the off chance that I have set up a module incorrectly or I'm not populating /sys/kernel/config/usb_gadget/ correctly, I'd figure my best bet are these forums. Any input is greatly appreciated!
my config.txt:
https://toastmasters227.mooo.com/config.txt
my cmdline.txt:
$this->bbcode_second_pass_code('', 'root=/dev/sda1 rw rootwait console=serial0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=serial0,115200 modules-load=dwc2,libcomposite,g_hid')
my /etc/modules (I'm pretty sure this is Raspbian specific):
$this->bbcode_second_pass_code('', 'libcomposite
dwc2
g_hid')
my /etc/systemd/system/key.service:
https://toastmasters227.mooo.com/keys
my /root/usb:
https://toastmasters227.mooo.com/usb