0

I have a project which consists into using a device running Ubuntu server which will be connected to a windows computer through a USB-C/USB-A cable. The USB-C would be connected the Ubuntu device and the USB-A to the windows computer. The PC will then send data through this cable to the Ubuntu emulated mass storage.

What changes do I have to make to the BIOS, ACPI or else to make this possible?

sudo lspci -nn -d ::0c03 -v provides me this output:

00:14.0 USB controller [0c03]: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller [8086:9d2f] (rev 21) (prog-if 30 [XHCI])
        DeviceName: Onboard - Other
        Subsystem: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller [8086:7270]
        Flags: bus master, medium devsel, latency 0, IRQ 125
        Memory at df530000 (64-bit, non-prefetchable) [size=64K]
        Capabilities: [70] Power Management version 2
        Capabilities: [80] MSI: Enable+ Count=1/8 Maskable- 64bit+
        Kernel driver in use: xhci_hcd

00:14.1 USB controller [0c03]: Intel Corporation Device [8086:9d30] (rev 21) (prog-if fe [USB Device])
        DeviceName: Onboard - Other
        Subsystem: Intel Corporation Device [8086:7270]
        Flags: bus master, fast devsel, latency 0, IRQ 17
        Memory at df000000 (64-bit, non-prefetchable) [size=2M]
        Memory at df54f000 (64-bit, non-prefetchable) [size=4K]
        Capabilities: [80] Power Management version 3
        Capabilities: [90] Vendor Specific Information: Len=14 <?>
        Kernel driver in use: dwc3-pci
        Kernel modules: dwc3_pci

EDIT:

I already had the g_mass_storage module loaded in my kernel and CONFIG_USB_DWC3_DUAL_ROLE=y in my .config file.

I tried to mount debugfs virtual filesystem using your command @telcoM and I got the following output:

mount: /sys/kernel/debug: none already mounted on /sys/fs/bpf.

I suppose it is not an issue but I just wanted to point it out just in case.

I checked my /sys/kernel/debug directory but I couldn't find any <hexa number>.usb directories. I couldn't find anyfile at all in /sys/fs/bpf.

EDIT 2:

This is my ACPI configuration:

BIOS-e820: [mem 0x00000000851cb000-0x00000000851cbfff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x000000008c6ea000-0x000000008ca93fff] ACPI NVS
[    0.013210] ACPI: Early table checksum verification disabled
[    0.013214] ACPI: RSDP 0x00000000000F05B0 000024 (v02 ALASKA)
[    0.013218] ACPI: XSDT 0x000000008C6EA0B0 0000DC (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.013224] ACPI: FACP 0x000000008C713958 000114 (v06 ALASKA A M I    01072009 AMI  00010013)
[    0.013230] ACPI: DSDT 0x000000008C6EA220 029734 (v02 ALASKA A M I    01072009 INTL 20160422)
[    0.013233] ACPI: FACS 0x000000008CA93F00 000040
[    0.013236] ACPI: APIC 0x000000008C713A70 000084 (v03 ALASKA A M I    01072009 AMI  00010013)
[    0.013239] ACPI: FPDT 0x000000008C713AF8 000044 (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.013242] ACPI: FIDT 0x000000008C713B40 00009C (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.013246] ACPI: MCFG 0x000000008C713BE0 00003C (v01 ALASKA A M I    01072009 MSFT 00000097)
[    0.013249] ACPI: SSDT 0x000000008C713C20 000359 (v01 SataRe SataTabl 00001000 INTL 20160422)
[    0.013252] ACPI: SSDT 0x000000008C713F80 003165 (v02 SaSsdt SaSsdt   00003000 INTL 20160422)
[    0.013256] ACPI: HPET 0x000000008C7170E8 000038 (v01 INTEL  KBL-ULT  00000001 MSFT 0000005F)
[    0.013259] ACPI: SSDT 0x000000008C717120 0011AA (v02 INTEL  Ther_Rvp 00001000 INTL 20160422)
[    0.013262] ACPI: SSDT 0x000000008C7182D0 0009B3 (v02 INTEL  xh_rvp07 00000000 INTL 20160422)
[    0.013265] ACPI: UEFI 0x000000008C718C88 000048 (v01 ALASKA A M I    00000002      01000013)
[    0.013269] ACPI: SSDT 0x000000008C718CD0 0017AE (v02 CpuRef CpuSsdt  00003000 INTL 20160422)
[    0.013272] ACPI: LPIT 0x000000008C71A480 000094 (v01 INTEL  KBL-ULT  00000000 MSFT 0000005F)
[    0.013275] ACPI: SSDT 0x000000008C71A518 000141 (v02 INTEL  HdaDsp   00000000 INTL 20160422)
[    0.013278] ACPI: SSDT 0x000000008C71A660 00029F (v02 INTEL  sensrhub 00000000 INTL 20160422)
[    0.013282] ACPI: SSDT 0x000000008C71A900 003002 (v02 INTEL  PtidDevc 00001000 INTL 20160422)
[    0.013285] ACPI: SSDT 0x000000008C71D908 000517 (v02 INTEL  TbtTypeC 00000000 INTL 20160422)
[    0.013288] ACPI: SSDT 0x000000008C71DE20 0002E9 (v02 INTEL  Wwan     00000001 INTL 20160422)
[    0.013291] ACPI: DBGP 0x000000008C71E110 000034 (v01 INTEL           00000002 MSFT 0000005F)
[    0.013294] ACPI: DBG2 0x000000008C71E148 000054 (v00 INTEL           00000002 MSFT 0000005F)
[    0.013297] ACPI: DMAR 0x000000008C71E1A0 0000B0 (v01 INTEL  EDK2     00000001 INTL 00000001)
[    0.013300] ACPI: ASF! 0x000000008C71E250 0000A0 (v32 INTEL   HCG     00000001 TFSM 000F4240)
[    0.013304] ACPI: WSMT 0x000000008C71E2F0 000028 (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.013312] ACPI: Local APIC address 0xfee00000
[    0.046794] ACPI: PM-Timer IO Port: 0x1808
[    0.046796] ACPI: Local APIC address 0xfee00000
[    0.046803] ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
[    0.046804] ACPI: LAPIC_NMI (acpi_id[0x02] high edge lint[0x1])
[    0.046805] ACPI: LAPIC_NMI (acpi_id[0x03] high edge lint[0x1])
[    0.046806] ACPI: LAPIC_NMI (acpi_id[0x04] high edge lint[0x1])
[    0.046840] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.046841] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.046843] ACPI: IRQ0 used by override.
[    0.046844] ACPI: IRQ9 used by override.
[    0.046846] Using ACPI (MADT) for SMP configuration information
[    0.046848] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.112942] ACPI: Core revision 20190816
[    0.145825] PM: Registering ACPI NVS region [mem 0x851cb000-0x851cbfff] (4096 bytes)
[    0.145825] PM: Registering ACPI NVS region [mem 0x8c6ea000-0x8ca93fff] (3842048 bytes)
[    0.145825] ACPI: bus type PCI registered
[    0.145825] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[    0.149423] ACPI: Added _OSI(Module Device)
[    0.149425] ACPI: Added _OSI(Processor Device)
[    0.149426] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.149428] ACPI: Added _OSI(Processor Aggregator Device)
[    0.149431] ACPI: Added _OSI(Linux-Dell-Video)
[    0.149433] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    0.149435] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[    0.202623] ACPI: 11 ACPI AML tables successfully acquired and loaded
[    0.211141] ACPI: Dynamic OEM Table Load:
[    0.211150] ACPI: SSDT 0xFFFF9F1A65816800 00060F (v02 PmRef  Cpu0Ist  00003000 INTL 20160422)
[    0.213026] ACPI: \_PR_.PR00: _OSC native thermal LVT Acked
[    0.214941] ACPI: Dynamic OEM Table Load:
[    0.214948] ACPI: SSDT 0xFFFF9F1A64CAEC00 0003FF (v02 PmRef  Cpu0Cst  00003001 INTL 20160422)
[    0.216719] ACPI: Dynamic OEM Table Load:
[    0.216725] ACPI: SSDT 0xFFFF9F1A64C78480 0000BA (v02 PmRef  Cpu0Hwp  00003000 INTL 20160422)
[    0.218405] ACPI: Dynamic OEM Table Load:
[    0.218411] ACPI: SSDT 0xFFFF9F1A64EAC800 000628 (v02 PmRef  HwpLvt   00003000 INTL 20160422)
[    0.220598] ACPI: Dynamic OEM Table Load:
[    0.220607] ACPI: SSDT 0xFFFF9F1A6532B000 000D14 (v02 PmRef  ApIst    00003000 INTL 20160422)
[    0.223342] ACPI: Dynamic OEM Table Load:
[    0.223349] ACPI: SSDT 0xFFFF9F1A64CAD400 000317 (v02 PmRef  ApHwp    00003000 INTL 20160422)
[    0.225173] ACPI: Dynamic OEM Table Load:
[    0.225180] ACPI: SSDT 0xFFFF9F1A64CAF800 00030A (v02 PmRef  ApCst    00003000 INTL 20160422)
[    0.230370] ACPI: Interpreter enabled
[    0.230422] ACPI: (supports S0 S3 S4 S5)
[    0.230425] ACPI: Using IOAPIC for interrupt routing
[    0.230476] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.231867] ACPI: Enabled 6 GPEs in block 00 to 7F
[    0.241288] ACPI: Power Resource [WRST] (on)
[    0.263566] ACPI: Power Resource [FN00] (off)
[    0.263696] ACPI: Power Resource [FN01] (off)
[    0.263828] ACPI: Power Resource [FN02] (off)
[    0.263951] ACPI: Power Resource [FN03] (off)
[    0.264074] ACPI: Power Resource [FN04] (off)
[    0.265863] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-fe])
[    0.277730] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.277808] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 *10 11 12 14 15)
[    0.277882] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.277956] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.278030] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.278103] ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.278176] ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.278250] ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.279095] ACPI: bus type USB registered
[    0.279095] PCI: Using ACPI for IRQ routing
[    0.321967] pnp: PnP ACPI init
[    0.322408] system 00:00: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.322461] pnp 00:01: Plug and Play ACPI device, IDs PNP0303 PNP030b (active)
[    0.322520] pnp 00:02: Plug and Play ACPI device, IDs PNP0f03 PNP0f13 (active)
[    0.322736] system 00:03: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.322862] pnp 00:04: Plug and Play ACPI device, IDs PNP0b00 (active)
[    0.322912] system 00:05: Plug and Play ACPI device, IDs INT3f0d PNP0c02 (active)
[    0.323266] system 00:06: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.323337] system 00:07: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.323739] system 00:08: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.325460] system 00:09: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.326686] pnp: PnP ACPI: found 10 devices
[    0.716581] ACPI: Sleep Button [SLPB]
[    0.718428] ACPI: Power Button [PWRB]
[    0.720134] ACPI: Power Button [PWRF]
[    0.723097] ACPI: Thermal Zone [TZ00] (28 C)
[    0.724786] ACPI: Thermal Zone [TZ01] (30 C)
[    7.658677] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
1
2

Are you asking about the USB controller's OTG feature, or specifically about the BIOS setting?

To answer for the former, it would be necessary to know which USB controller is used on your machine; it might be as simple as loading either the USB host controller driver or the US "gadget" driver modules.

For the latter, you should specify the make and model of your machine so that we can try and find out if there is a vendor-provided tool or other means to change the BIOS setting while within the OS.


You have two USB controllers. The first is the regular USB3 controller built into the chipset:

00:14.0 USB controller [0c03]: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller [8086:9d2f] 

The second is more relevant to your question:

00:14.1 USB controller [0c03]: Intel Corporation Device [8086:9d30]
...
Kernel driver in use: dwc3-pci
Kernel modules: dwc3_pci

The module name dwc3_pci indicates it's a DesignWare USB 3.0 Dual-Role Device Controller. In other words, this is a controller that can switch from host role to device role and vice versa.

From here I found the description of the role-switching procedure. Note that it says:

Dynamically changing the mode of operation can be useful for debug purposes but this should never be used in production.

You would need to have CONFIG_USB_DWC3_DUAL_ROLE selected in your kernel configuration, and the required USB Gadget driver for the functionality you'll need in the device role, e.g. the g_mass_storage module for having this system act like an USB storage device.

First you'll need to mount the debugfs virtual filesystem:

mount -t debugfs none /sys/kernel/debug

You should then find one or more directories named like /sys/kernel/debug/<some hexadecimal number>.usb. Each of those directories will contain files named link_state, mode, regdump and testmode. By reading the mode file, you'll see the role the controller is currently operating in; by writing to the file, you can change the role.

cd /sys/kernel/debug/<something>.usb
echo host > mode    # switch to host role
echo device > mode  # switch to device role

DISCLAIMER: I have no experience in actually using this USB controller in any way; this is completely based on just reading the documents I linked. I might be wrong. If anyone reading this knows more, feel free to edit this answer.

3
  • How can I find my USB controller on my machine? – snoopybroker Mar 11 at 8:54
  • On regular PC hardware, the output of sudo lspci -nn -d ::0c03 -v should list the USB controller(s), along with all the useful information to identify them. If you're running something more special, like ARM hardware, it might be trickier... but you said your Ubuntu machine has BIOS, so that's probably not an issue. – telcoM Mar 11 at 9:42
  • I took the liberty of editing the output from your non-Answer into your original Question. In StackExchange, the way to provide more information is to edit your question, not add "answer" posts that don't actually attempt to answer the question. Answer posts that don't contain actual answers will be flagged for deletion, but you might want to delete your non-answer yourself. – telcoM Mar 15 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.