Added connected devices list to health table
This commit is contained in:
parent
bc4bd7d39b
commit
5d86cbb74a
@ -22,28 +22,8 @@ function initPage() {
|
||||
const command5 = "iwgetid -r"
|
||||
const command6 = "ls /dev/video*"
|
||||
|
||||
// Commands for listing all Connected Devices
|
||||
const command7 = "ls /dev/block/*"
|
||||
const command8 = "ls /dev/bus/*"
|
||||
const command9 = "ls /dev/char/*"
|
||||
const command10 = "ls /dev/cpu/*"
|
||||
const command11 = "ls /dev/disk/*"
|
||||
const command12 = "ls /dev/dma_heap/*"
|
||||
const command13 = "ls /dev/dri/*"
|
||||
const command14 = "ls /dev/fd/*"
|
||||
const command15 = "ls /dev/hugepages/*"
|
||||
const command16 = "ls /dev/input/*"
|
||||
const command17 = "ls /dev/mapper/*"
|
||||
const command18 = "ls /dev/mqueue/*"
|
||||
const command19 = "ls /dev/net/*"
|
||||
const command20 = "ls /dev/pts/*"
|
||||
const command21 = "ls /dev/shm/*"
|
||||
const command22 = "ls /dev/snd/*"
|
||||
const command23 = "ls /dev/v4l/*"
|
||||
const command24 = "ls /dev/vfio/*"
|
||||
const devices_commands = [command7, command8, command9, command10, command11, command12, command13, command14, command15,
|
||||
command16, command17, command18, command19, command20, command21, command22, command23, command24
|
||||
];
|
||||
// Command for listing all Connected Devices
|
||||
const devices_command = "lsusb"
|
||||
|
||||
cockpit.spawn(["bash", "-c", command1])
|
||||
.then((data) => {
|
||||
@ -108,19 +88,21 @@ function initPage() {
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
|
||||
count = 0;
|
||||
for (let i = 0; i < devices_commands.length; i++) {
|
||||
cockpit.spawn(["bash", "-c", devices_commands[i]])
|
||||
.then((data) => {
|
||||
if (data.length != 0) {
|
||||
devices.innerHTML += data.replaceAll("\n", "<br>");
|
||||
devices.innerHTML += "<br>";
|
||||
count++
|
||||
cockpit.spawn(["bash", "-c", devices_command])
|
||||
.then((data) => {
|
||||
const datalist = data.split("\n");
|
||||
if (data.length == 0) {
|
||||
devices.innerHTML = "No devices detected";
|
||||
}
|
||||
for (let i = 0; i < datalist.length - 1; i++) {
|
||||
const name = datalist[i].split(" ");
|
||||
for (let j = 6; j < name.length; j++) {
|
||||
devices.innerHTML += name[j] + " ";
|
||||
}
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
}
|
||||
if (count > 0) {
|
||||
devices.innerHTML -= "<br>"
|
||||
}
|
||||
devices.innerHTML += "<br>";
|
||||
devices.innerHTML += "/dev/bus/usb/" + name[1] + "/" + name[3];
|
||||
devices.innerHTML += "<br><br>";
|
||||
}
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
}
|
Loading…
Reference in New Issue
Block a user