Skip to content

[BUG]: Enabling USB Gadget Mode persists between sessions resulting it being applied without displaying the option #1520

Description

@phattmatt

What happened?

Hi,

I noticed when writing recent images that the USB Gadget Mode was being applied, even though I wasn't using a custom manifest, and the option was not presented to me during the customisation process.

I believe that the setting has been saved to the registry during an image write while using a custom manifest, and is being applied in subsequent sessions, even though the default online manifest doesn't include the "usb_otg" capability.

To disable the USB Gadget Mode, I can load the custom manifest, which means the GUI shows the option, disable the USB Gadget Mode option, and then quit. Re-running RPI-Imager results in the USB Gadget Mode not being applied.

How to reproduce

  • Create a local manifest file with the "usb_otg" capability enabled, i.e:

./create_local_json.py --online --capabilities usb_otg --device-capabilities usb_otg

  • Run RPI-Imager and load the local custom manifest file
  • Select Raspberry Pi 5
  • Select Raspberry Pi OS Lite (64-bit)
  • Set customisations
  • Enable USB Gadget Mode
  • Quit (I don't think it's necessary to actually write an image for the setting to persist)
  • Run RPI-Imager (no custom manifest file)
  • Select Raspberry Pi 5
  • Select Raspberry Pi OS Lite (64-bit)
  • Set customisations
  • USB Gadget Mode is not offered as an option
  • Write the image
  • Check user-data on bootfs for USB Gadget Mode config:
rpi:
  enable_usb_gadget: true

Version

2.0.6 (Default)

What host operating system were you using?

Windows

Host OS Version

Windows 11 25H2

Selected OS

Raspberry Pi OS Lite (64-bit)

Which Raspberry Pi Device are you using?

Raspberry Pi 5, 500, and Compute Modules 5

What kind of storage device are you using?

microSD Card in a USB reader

OS Customisation

  • Yes, I was using OS Customisation when the bug occurred.

Relevant log output

Copy of my Raspberry Pi Imager Registry Entry which shows the persisted setting:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Raspberry Pi\Raspberry Pi Imager\imagecustomization]
"capitalCity"="London (United Kingdom)"
"enable1Wire"="false"
"enableI2C"="false"
"enableSPI"="false"
"enableSerial"="Disabled"
"enableUsbGadget"="true"
"hostname"="rpi5"
"keyboard"="gb"
"recommendedWifiCountry"="GB"
"sshEnabled"="true"
"sshPasswordAuth"="true"
"sshUserName"="pi"
"sshUserPassword"="Redacted"
"timezone"="Europe/London"
"wifiHidden"="false"
"wifiMode"="secure"
"wifiPasswordCrypt"="Redacted"
"wifiSSID"="Redacted"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions