matiaspl / LinkPi-ENCx

57 stars 10 forks source link

Breaking out of boot loop & 4G wwan/modem support #5

Open sesse opened 2 years ago

sesse commented 2 years ago

Hi,

I thought I'd leave this here as an interesting addition to your guides. I upgraded to the newest firmware (20211201), rebooted… and the device would go into an infinite bootloop. It'd respond to ping ~8–10 secs at a time, then stop and reboot.

After a bunch of fiddling, I found out that what's stopping it is the device watchdog. The only real way I found at stopping it was to kill the encoder process and then put ones own watchdog process to keep it from booting:

killall ash
killall Encoder
while :; do echo V; sleep 1; done > /dev/watchdog

If you're quick enough, you can telnet into the device when it starts responding, run those commands, and then it will be up and stable (watchdog subdued), so that you can downgrade to 20210927.

I still can't get any of the USB network devices to work, though :-) (Tried two rtl8821cu devices and one 4G device.) Not even after running usb_modeswitch manually. I guess it needs to be exactly the right USB ID for the software to pick it up, unfortunately.

matiaspl commented 2 years ago

Nice find, I'll add it to the document soon. I personally didn't have any issues with the watchdog on the newest firmware. I also had no luck with wifi but I don't have any realtek based wifi card at hand. As for 4G I remember trying a Huawei HiLink 4G E3272 dongle and I think it worked - I'll check again.

sesse commented 2 years ago

I think it's just super-picky on specific USB IDs, unfortunately. I do have a E3272 (bought an unlocked one off of eBay), but it doesn't even manage to mode-switch it away from the USB storage default.

matiaspl commented 2 years ago

@sesse that's true, there are some UVC devices (e.g. BMD Atem Mini series, HDMI capture dongles) that need updating udev config .rules files to work. I think that even updating the udev's list of known USB descriptors might magically fix those issues.

sesse commented 2 years ago

Hm, do you have a file I should look at for the lists? Or is it just the regular .rules files?

matiaspl commented 2 years ago

It's in the rules actually. I vaguely recall changing the PIDs to match my dongle in these places:

/etc/udev/rules.d/11-usb-hotplug.rules

(...)
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1f01",  RUN+="/etc/udev/usb4g.sh"
SUBSYSTEM=="net", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14db", KERNEL=="eth*",  RUN+="/etc/udev/usbUp.sh %k"
(...)

/etc/udev/usb4g.sh

#!/bin/sh
/usr/bin/usb_modeswitch -v 0x12d1 -p 0x1f01 -J

The usbUp.sh script just runs udhcpc on the right interface