If I boot up my Beryl AX with my Android phone already connected via USB, the Android phone doesn't recognize data transfer. It only charges the phone, and the panel looks like this:
If I boot up the router with the Android phone disconnected, wait until the boot is complete and THEN connect the phone, everything works fine.
I've tried to programmatically disable the USB port power, wait a few seconds and then re-enable the USB port power in a startup script to no avail.
It's also unable to connect to the repeater AP automatically on boot. It will try and fail (see screenshot above). If I go into the Android phone settings, disable and re-enable the hotspot and then change the MAC Mode in the "Modify" menu, it works. Other devices are able to connect to the hotspot just fine. It's just the Beryl AX that has issues and it's only after the Beryl reboots. This was fixed by using "Auto Update MAC" set to "Reboot" on 4.7.0. USB issues still persist.
Any advice or help would be GREATLY appreciated. Thank you so much!
The smartphone is a Moto G 5G (2023) running Android 14.
Reproduction steps:
Enable developer settings on phone, set USB tethering as default USB option.
Connect the phone via USB to unpowered Beryl AX.
Power up the Beryl AX.
Observe greyed out “USB tethering” option, as if data is not enabled for USB. Observe the phone charging.
Disconnect and reconnect the USB cable from the Beryl AX.
Observe previously disabled “USB tethering” option become enabled, automatically toggles on due to developer settings, interface comes up on the router, everything now works.
Is there any way I can get you better logs for diagnosis? Thank you so much.
It feels like it’s an issue with the USB driver, since the crux of the issue is the USB device lacking data upon boot until it’s unplugged and plugged back in.
I did some test and here is the result with iphone.
I used the 4.6.4-op24 firmware and it seems just works.
When I change to the 4.6.4 and I met some problems, e.g. cannot get IP. But it resolved itself after reboot iPhone. Also the mtu and interface tracking may matters.
Sorry I don't have the same Android to test. But here is everything that may matters.
Turn off interfact tracking. The ping actually caused problems in some situations.
Reset your phone's network or reboot it.
In our test of iPhone, when it has a problems we need to reboot the iPhone or reset the network of iPhone. It just resolve the problem.
Not sure for Andriod but better do the same to see if it helps.
Thank you so much, @alzhao. I regret to inform you that I tried 1, 2 and 3 and had no success.
To help aid you further, I've disabled Adguard Home, powered down my Beryl AX and booted it back up with the Android phone connected via USB--I then exported the logs which I'll be attaching to this message. Hopefully without the Adguard spam, it'll be easier to see what's going on here.
It feels like there's something going wrong during the boot process that's preventing the USB device from properly initializing. I'm unable to communicate with the USB device via SSH (eg. via adb, which returns error: device not found) on the Beryl AX until I unplug the phone via USB and plug it back in. Then everything works.
Surely there's a clue in the logs somewhere, I just need your help deciphering that.
Doing echo 0 > /sys/class/gpio/usb_power/value and echo 1 > /sys/class/gpio/usb_power/value (or via hub-ctrl) only toggles the USB power, it doesn't simulate unplugging and replugging the USB cable. Can you think of any commands I can run to fully disable and fully enable the USB port, as if I physically unplugged it? If I were to automate that during startup, I think it would fix my problem.
This would indicate that 11200000.xhci is not the device even though your lsusb command returned that it was.
Try running ls /sys/bus/pci/drivers/xhci_hcd/ with the phone plugged in and again after the phone is unplugged to see what the USB controller is named for sure.
Then update the script as needed for the correct device name.
root@GL-MT3000:/sys/bus/usb/drivers/usb# ls /sys/bus/pci/drivers/xhci_hcd/
bind new_id remove_id uevent unbind
With it unplugged (appears to be same output):
root@GL-MT3000:/sys/bus/usb/drivers/usb# ls /sys/bus/pci/drivers/xhci_hcd/
bind new_id remove_id uevent unbind
And yeah, everything points to 11200000.xhci being the correct device name, so I'm pretty baffled what's going on. Doing some googling on sh: write error: No such device doesn't appear to yield anything useful.
Have you also tried running the commands manually outside of the script?
Also tried a reboot reset of the router?
As you mentioned to me in private message earlier, your fear that the issue could be the Linux kernel (version 5.4.211) might be correct. Some limitation or bug with the xHCI driver or USB implementations for certain devices I would guess. Not a GL.iNet issue of course.
The last thing I can recommend is checking the system logs (dmesg or /var/log/syslog) for any related errors.
Yep, I have tried both in the script and outside the script.
Also tried a reboot of the router?
Yep, tried that too.
I looked through system logs and everything looks identical to the log .tar I uploaded above.
I feel like we're on the right path, that is creating a startup script that unbinds/binds the device to simulate unplugging and plugging in the USB cable. Perhaps there's something else I can try?
I would love to avoid replacing the Beryl AX with a different travel router if possible, I really like the little thing.
Note: I discovered that by disabling USB power via /sys/class/gpio/usb_power, it fixes the issue. However this isn't a viable solution for me as I need the phone to charge. Perhaps that's a clue of some sort.
Again, if this doesn't work I strongly suspect it's an issue with the way the kernel interacts with this USB device and there's nothing we can really do because the linux kernel is bundled with the GL.iNet firmware. You'll probably need to post on some more linux dev-focused forums to see if they've seen this issue and maybe they'll have a suggestion or even a patch.
Hi @alzhao! I have tried that. Regardless of the amount of sleep between the commands, the USB tethering option is disabled once the USB port has its power re-enabled.
Only turning off the power works to fix the tethering issue (but is not a viable solution for me since I need charging). Turning off and on the power doesn’t work.
I am about to attempt using a powered USB hub attached to the Beryl AX, with the Moto G smartphone plugged into the hub. I am then going to disable /sys/class/gpio/usb_power/value on the Beryl AX. My hopes here is that it'll allow the USB tethering to activate AND charge the phone. Will update this thread with my results.
With the smartphone connected via USB to the Beryl AX while it's booting, the device doesn't even show up in lsusb until I turn USB power off. And when I turn it back on, the device disappears.
root@GL-MT3000:~# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux 5.4.211 xhci-hcd xHCI Host Controller
Bus 001 Device 001: ID 1d6b:0002 Linux 5.4.211 xhci-hcd xHCI Host Controller
root@GL-MT3000:~# echo 0 > /sys/class/gpio/usb_power/value;
root@GL-MT3000:~# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux 5.4.211 xhci-hcd xHCI Host Controller
Bus 001 Device 006: ID 22b8:2e25 motorola moto g 5G (XT2417D)
Bus 001 Device 001: ID 1d6b:0002 Linux 5.4.211 xhci-hcd xHCI Host Controller
root@GL-MT3000:~# echo 1 > /sys/class/gpio/usb_power/value;
root@GL-MT3000:~# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux 5.4.211 xhci-hcd xHCI Host Controller
Bus 001 Device 001: ID 1d6b:0002 Linux 5.4.211 xhci-hcd xHCI Host Controller
root@GL-MT3000:~#
I will next be looking into tweaking /etc/usb-mode.json as I'm pretty much back at square one now.
Just had another thought: Maybe the Android device is only showing when I physically unplug it and plug it back in because some magic is happening in /etc/hotplug.d. Thoughts?