File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import {
37
37
ProgressNotification ,
38
38
LocatorNotification ,
39
39
OverTemperatureNotification ,
40
+ UsbOverloadNotification ,
40
41
} from "./TacComponents" ;
41
42
42
43
function Navigation ( ) {
@@ -159,6 +160,7 @@ function Notifications() {
159
160
< RebootNotification />
160
161
< OverTemperatureNotification />
161
162
< ProgressNotification />
163
+ < UsbOverloadNotification />
162
164
< UpdateNotification />
163
165
< LocatorNotification />
164
166
< IOBusFaultNotification />
Original file line number Diff line number Diff line change @@ -89,6 +89,13 @@ enum RaucInstallStep {
89
89
Done ,
90
90
}
91
91
92
+ enum UsbOverload {
93
+ Total = "Total" ,
94
+ Port1 = "Port1" ,
95
+ Port2 = "Port2" ,
96
+ Port3 = "Port3" ,
97
+ }
98
+
92
99
type Duration = {
93
100
secs : number ;
94
101
nanos : number ;
@@ -520,3 +527,39 @@ export function OverTemperatureNotification() {
520
527
</ Alert >
521
528
) ;
522
529
}
530
+
531
+ export function UsbOverloadNotification ( ) {
532
+ const overload = useMqttSubscription < UsbOverload | null > (
533
+ "/v1/usb/host/overload" ,
534
+ ) ;
535
+
536
+ let header = "One of the USB host ports is overloaded" ;
537
+ let detail = "" ;
538
+
539
+ switch ( overload ) {
540
+ case UsbOverload . Total :
541
+ header = "The USB host ports are overloaded" ;
542
+ detail = "devices" ;
543
+ break ;
544
+ case UsbOverload . Port1 :
545
+ detail = "the device from port 1" ;
546
+ break ;
547
+ case UsbOverload . Port2 :
548
+ detail = "the device from port 2" ;
549
+ break ;
550
+ case UsbOverload . Port3 :
551
+ detail = "the device from port 3" ;
552
+ break ;
553
+ }
554
+
555
+ return (
556
+ < Alert
557
+ statusIconAriaLabel = "Warning"
558
+ type = "warning"
559
+ visible = { overload !== null }
560
+ header = { header }
561
+ >
562
+ Disconnect { detail } or use a powered hub to resolve this issue.
563
+ </ Alert >
564
+ ) ;
565
+ }
You can’t perform that action at this time.
0 commit comments