I want to interact with GRUB through a usb-to-serial converter.
I was able to achieve this on my laptop by using this list of commands in grub's cli:
insmod nativedisk #to not loose drive information after insmod *hci
nativedisk ahci
insmod ehci
insmod ohci
insmod uhci
insmod usbserial_ftdi # I use an ftdi usb to serial adapter
terminal_output --append serial_usb0
terminal_input --append serial_usb0
The same procedure did not work on my desktop pc, the problem being that grub looses drives information after doing insmod ehci, meaning that an ls after that returns no disk, and thus all the next commands fail, nothing can be done anymore and I have to reboot.
This problem was fixed on my SATA-based laptop as shown above by using nativedisk ahci, this command doesn't work on the desktop pc because it uses NVMe (pcie) drives, and the ahci module is for SATA drives.
The GRUB's docs page of nativedisk doesn't list any parameter that can be used, and looking in the source code I see a few parameters for nativedisk, which unfortunately don't fix my problem.
So my question is, why does GRUB loose drives information when insmoding the various *hci modules? How do I prevent/work around this?