File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ var defaultConfig = &Config{
125
125
RelativeMouse : true ,
126
126
Keyboard : true ,
127
127
MassStorage : true ,
128
+ Audio : true ,
128
129
},
129
130
NetworkConfig : & network.NetworkConfig {},
130
131
DefaultLogLevel : "INFO" ,
Original file line number Diff line number Diff line change @@ -63,6 +63,23 @@ var defaultGadgetConfig = map[string]gadgetConfigItem{
63
63
// mass storage
64
64
"mass_storage_base" : massStorageBaseConfig ,
65
65
"mass_storage_lun0" : massStorageLun0Config ,
66
+ // audio
67
+ "audio" : {
68
+ order : 4000 ,
69
+ device : "uac1.usb0" ,
70
+ path : []string {"functions" , "uac1.usb0" },
71
+ configPath : []string {"uac1.usb0" },
72
+ attrs : gadgetAttributes {
73
+ "p_chmask" : "3" ,
74
+ "p_srate" : "48000" ,
75
+ "p_ssize" : "2" ,
76
+ "p_volume_present" : "0" ,
77
+ "c_chmask" : "3" ,
78
+ "c_srate" : "48000" ,
79
+ "c_ssize" : "2" ,
80
+ "c_volume_present" : "0" ,
81
+ },
82
+ },
66
83
}
67
84
68
85
func (u * UsbGadget ) isGadgetConfigItemEnabled (itemKey string ) bool {
@@ -77,6 +94,8 @@ func (u *UsbGadget) isGadgetConfigItemEnabled(itemKey string) bool {
77
94
return u .enabledDevices .MassStorage
78
95
case "mass_storage_lun0" :
79
96
return u .enabledDevices .MassStorage
97
+ case "audio" :
98
+ return u .enabledDevices .Audio
80
99
default :
81
100
return true
82
101
}
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ type Devices struct {
17
17
RelativeMouse bool `json:"relative_mouse"`
18
18
Keyboard bool `json:"keyboard"`
19
19
MassStorage bool `json:"mass_storage"`
20
+ Audio bool `json:"audio"`
20
21
}
21
22
22
23
// Config is a struct that represents the customizations for a USB gadget.
You can’t perform that action at this time.
0 commit comments