device.list

device.list

device.list

Function

Returns the list of open devices still visible to the current program.

Syntax

Parameters

No parameters.

Return value

TypeDescription
ArrayReturns an array of opened device information objects.

Device information field

Each object in the array represents an open device that is still visible to the current program.

FieldTypeMust existDescription
typeStringYesThe device type, currently serial.
portStringYesThe serial port name used when opening the device.
baud_rateIntYesThe baud rate used when opening the serial port.
closedBoolYesWhether the underlying device connection has been closed. true means it has been closed and cannot continue to read or write.

Example

Notes

  • Weak references that have been released will be cleaned up when listing.
  • device.list() only lists devices that have been opened in the current process and are still referenced, not a full serial port scan of the system.