Open dpan817 opened 5 years ago
Hi @dpan817,
To switch USB OTG port to device mode, kindly use this command. echo device > /sys/class/usb_role/intel_xhci_usb_sw-role-switch/role
To switch USB OTG port to host mode, kindly use this command. echo host > /sys/class/usb_role/intel_xhci_usb_sw-role-switch/role
Module parameter for default mode to Hardware mode automatic role is not available. However, you still can set the default Software mode. To set default mode to Software mode Device role, please use intel_xhci_usb_role_switch.default_role=1 To set default mode to Software mode Host role, please use intel_xhci_usb_role_switch.default_role=2
Thank you.
I view this comment and description is wrong. (@chongyic)
To set default mode to Software mode Device role, please use intel_xhci_usb_role_switch.default_role=2 To set default mode to Software mode Host role, please use intel_xhci_usb_role_switch.default_role=1
Thank you.
Thanks for your answer, @chongyic ! How could I organize the OTG device on the USB device port? Is there any example, particularly for the USB role-switchable port?
I am trying to switch the USB port on Apollo Lake (E3900) from host to device, so that I can run the USB OTG functions (EEM function). I got the code from Branch E3900-MR4 and built the kernel with default configuration in this code branch. I can build the kernel and boot in the Ubuntu 16.04 environment successfully. After load the modules successfully, the directories /sys/class/udc and /sys/class/usb_role are empty, how can I switch the USB role with the user space commands?
adlink@adlink-NanoX-AL:~$ lsmod | grep usb usb_f_eem 16384 0 u_ether 20480 1 usb_f_eem intel_xhci_usb_role_switch 16384 0 roles 16384 1 intel_xhci_usb_role_switch libcomposite 53248 3 usb_f_eem configfs 32768 3 usb_f_eem,libcomposite udc_core 40960 3 u_ether,usb_f_eem,libcomposite adlink@adlink-NanoX-AL:~$ ls /sys/class/usb_role/ adlink@adlink-NanoX-AL:~$ ls /sys/class/udc/
adlink@adlink-NanoX-AL:~$ cat /proc/cpuinfo | grep model model : 92 model name : Intel(R) Atom(TM) Processor E3930 @ 1.30GHz model : 92 model name : Intel(R) Atom(TM) Processor E3930 @ 1.30GHz
adlink@adlink-NanoX-AL:~$ cat /proc/version Linux version 4.14.67-pan-intel-pk-standard (root@adlink-1080ti) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)) #5 SMP PREEMPT Thu Mar 7 15:16:47 CST 2019
adlink@adlink-NanoX-AL:~$ lsb_release -r Release: 16.04
on the old branch (E3900-MR3.1), I can switch the USB role with command “modprobe portmux-intel-drcfg usb0_auto_role=1”, but in the E3900-MR4 branch, there is no this module any more.
Thanks Pan Deng