feat(usb_mass_storage): mount as disk (#333)

* feat(usb_mass_storage): mount as disk

* chore: try to set initial virtual media state from sysfs

* chore(usb-mass-storage): fix inquiry_string
This commit is contained in:
Aveline
2025-05-12 19:07:27 +02:00
committed by GitHub
parent 8ee0532f0e
commit 63c2272c45
6 changed files with 137 additions and 27 deletions

View File

@@ -566,9 +566,12 @@ type RPCHandler struct {
func rpcSetMassStorageMode(mode string) (string, error) {
logger.Info().Str("mode", mode).Msg("Setting mass storage mode")
var cdrom bool
if mode == "cdrom" {
switch mode {
case "cdrom":
cdrom = true
} else if mode != "file" {
case "file":
cdrom = false
default:
logger.Info().Str("mode", mode).Msg("Invalid mode provided")
return "", fmt.Errorf("invalid mode: %s", mode)
}
@@ -587,7 +590,7 @@ func rpcSetMassStorageMode(mode string) (string, error) {
}
func rpcGetMassStorageMode() (string, error) {
cdrom, err := getMassStorageMode()
cdrom, err := getMassStorageCDROMEnabled()
if err != nil {
return "", fmt.Errorf("failed to get mass storage mode: %w", err)
}