mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-05-27 08:35:10 +02:00
Update App version to 0.1.2
Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
@@ -51,14 +51,15 @@ func (u *UsbGadget) RebindUsb(ignoreUnbindError bool) error {
|
||||
}
|
||||
|
||||
// GetUsbState returns the current state of the USB gadget
|
||||
func (u *UsbGadget) GetUsbState() (state string) {
|
||||
// Check the auxiliary disc node first
|
||||
discFile := "/sys/devices/platform/ff3e0000.usb2-phy/disc"
|
||||
discBytes, err := os.ReadFile(discFile)
|
||||
if err == nil {
|
||||
discState := strings.TrimSpace(string(discBytes))
|
||||
if discState == "DISCONNECTED" {
|
||||
return "not attached"
|
||||
func (u *UsbGadget) GetUsbState(enhancedDetection bool) (state string) {
|
||||
if enhancedDetection {
|
||||
discFile := "/sys/devices/platform/ff3e0000.usb2-phy/disc"
|
||||
discBytes, err := os.ReadFile(discFile)
|
||||
if err == nil {
|
||||
discState := strings.TrimSpace(string(discBytes))
|
||||
if discState == "DISCONNECTED" {
|
||||
return "not attached"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user