From 429d8bbeaddf29f0a6463e53bb31f22ed1276dd7 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Fri, 31 Mar 2023 13:08:23 -0400 Subject: [PATCH] move enable_usb from /etc/functions to /etc/ash_functions so that usb keyboard can be enabled from init Reminder: insmod is a bash script and will fail on legacy-flash boards (which should not enable USB_KEYBOARD anyway) --- initrd/etc/ash_functions | 44 +++++++++++++++++++++++++++++++++++++++ initrd/etc/functions | 45 ---------------------------------------- 2 files changed, 44 insertions(+), 45 deletions(-) diff --git a/initrd/etc/ash_functions b/initrd/etc/ash_functions index 9156fae5..8539d174 100644 --- a/initrd/etc/ash_functions +++ b/initrd/etc/ash_functions @@ -85,3 +85,47 @@ combine_configs() { TRACE "Under /etc/functions:combine_configs" cat /etc/config* > /tmp/config } + +enable_usb() +{ + TRACE "Under /etc/functions:enable_usb" + #insmod ehci_hcd prior of uhdc_hcd and ohci_hcd to suppress dmesg warning + if ! lsmod | grep -q ehci_hcd; then + insmod /lib/modules/ehci-hcd.ko \ + || die "ehci_hcd: module load failed" + fi + if [ "$CONFIG_LINUX_USB_COMPANION_CONTROLLER" = y ]; then + if ! lsmod | grep -q uhci_hcd; then + insmod /lib/modules/uhci-hcd.ko \ + || die "uhci_hcd: module load failed" + fi + if ! lsmod | grep -q ohci_hcd; then + insmod /lib/modules/ohci-hcd.ko \ + || die "ohci_hcd: module load failed" + fi + if ! lsmod | grep -q ohci_pci; then + insmod /lib/modules/ohci-pci.ko \ + || die "ohci_pci: module load failed" + fi + fi + if ! lsmod | grep -q ehci_pci; then + insmod /lib/modules/ehci-pci.ko \ + || die "ehci_pci: module load failed" + fi + if ! lsmod | grep -q xhci_hcd; then + insmod /lib/modules/xhci-hcd.ko \ + || die "xhci_hcd: module load failed" + fi + if ! lsmod | grep -q xhci_pci; then + insmod /lib/modules/xhci-pci.ko \ + || die "xhci_pci: module load failed" + sleep 2 + fi + + if [ "$CONFIG_USB_KEYBOARD" = y ]; then + if ! lsmod | grep -q usbhid; then + insmod /lib/modules/usbhid.ko \ + || die "usbhid: module load failed" + fi + fi +} diff --git a/initrd/etc/functions b/initrd/etc/functions index ea883583..9bb0e665 100755 --- a/initrd/etc/functions +++ b/initrd/etc/functions @@ -81,51 +81,6 @@ confirm_totp() echo } -enable_usb() -{ - TRACE "Under /etc/functions:enable_usb" - #insmod ehci_hcd prior of uhdc_hcd and ohci_hcd to suppress dmesg warning - if ! lsmod | grep -q ehci_hcd; then - insmod /lib/modules/ehci-hcd.ko \ - || die "ehci_hcd: module load failed" - fi - if [ "$CONFIG_LINUX_USB_COMPANION_CONTROLLER" = y ]; then - if ! lsmod | grep -q uhci_hcd; then - insmod /lib/modules/uhci-hcd.ko \ - || die "uhci_hcd: module load failed" - fi - if ! lsmod | grep -q ohci_hcd; then - insmod /lib/modules/ohci-hcd.ko \ - || die "ohci_hcd: module load failed" - fi - if ! lsmod | grep -q ohci_pci; then - insmod /lib/modules/ohci-pci.ko \ - || die "ohci_pci: module load failed" - fi - fi - if ! lsmod | grep -q ehci_pci; then - insmod /lib/modules/ehci-pci.ko \ - || die "ehci_pci: module load failed" - fi - if ! lsmod | grep -q xhci_hcd; then - insmod /lib/modules/xhci-hcd.ko \ - || die "xhci_hcd: module load failed" - fi - if ! lsmod | grep -q xhci_pci; then - insmod /lib/modules/xhci-pci.ko \ - || die "xhci_pci: module load failed" - sleep 2 - fi - - if [ "$CONFIG_USB_KEYBOARD" = y ]; then - if ! lsmod | grep -q usbhid; then - insmod /lib/modules/usbhid.ko \ - || die "usbhid: module load failed" - fi - fi - -} - list_usb_storage() { TRACE "Under /etc/functions:list_usb_storage"