maix.sys

maix.sys module

You can use maix.sys to access this module with MaixPy
This module is generated from MaixPy and MaixCDK

Module

No module

Enum

Variable

Function

os_version

def os_version() -> str

Get system version

item description
return version string, e.g. "maixcam-2024-08-13-maixpy-v4.4.20"

C++ defination code:

std::string os_version()

maixpy_version

def maixpy_version() -> str

Get MaixPy version, if get failed will return empty string.

item description
return version string, e.g. "4.4.21"

C++ defination code:

std::string maixpy_version()

device_id

Get device configs, we also say board configs. e.g. for MaixCAM it read form /boot/board

item description
param cache: read id from cache(if exists, or will call device_configs first internally) if true,
if false, always read fron config file.
return device id, e.g. "maixcam" "maixcam_pro"

C++ defination code:

std::map<std::string, std::string> device_configs(bool cache = true)

device_id (overload 1)

Get device id

item description
param cache: read id from cache(if exists, or will call device_configs first internally) if true,
if false, always read fron config file.
return device id, e.g. "maixcam" "maixcam_pro"

C++ defination code:

std::string device_id(bool cache = true)

device_name

def device_name(cache: bool = True) -> str

Get device name

item description
param cache: read id from cache(if exists, or will call device_configs first internally) if true,
if false, always read fron config file.
return device name, e.g. "MaixCAM" "MaixCAM-Pro"

C++ defination code:

std::string device_name(bool cache = true)

host_name

def host_name() -> str

Get host name

item description
return host name, e.g. "maixcam-2f9f"

C++ defination code:

std::string host_name()

host_domain

def host_domain() -> str

Get host domain

item description
return host domain, e.g. "maixcam-2f9f.local"

C++ defination code:

std::string host_domain()

ip_address

def ip_address() -> dict[str, str]

Get ip address

item description
return ip address, dict type, e.g. {"eth0": "192.168.0.195", "wlan0": "192.168.0.123", "usb0": "10.47.159.1"}

C++ defination code:

std::map<std::string, std::string> ip_address()

mac_address

def mac_address() -> dict[str, str]

Get mac address

item description
return mac address, dict type, e.g. {"eth0": "00:0c:29:2f:9f:00", "wlan0": "00:0c:29:2f:9f:01", "usb0": "00:0c:29:2f:9f:02"}

C++ defination code:

std::map<std::string, std::string> mac_address()

device_key

def device_key() -> str

Get device key, can be unique id of device

item description
return device key, 32 bytes hex string, e.g. "1234567890abcdef1234567890abcdef"

C++ defination code:

std::string device_key()

memory_info

def memory_info() -> dict[str, int]

Get memory info

item description
return memory info, dict type, e.g. {"total": 1024, "used": 512, "hw_total": 25610241024}
total: total memory size in Byte.
used: used memory size in Byte.
hw_total: total memory size in Byte of hardware, the total <= hw_total,
OS kernel may reserve some memory for some hardware like camera, npu, display etc.

C++ defination code:

std::map<std::string, int> memory_info()

bytes_to_human

def bytes_to_human(bytes: int, precision: int = 2, base: int = 1024, unit: str = 'B', sep: str = ' ') -> str

Bytes to human readable string

item description
param bytes:: bytes size,e.g. 1234B = 1234/1024 = 1.205 KB
precision:: decimal precision, default 2
base:: base number, default 1024
unit:: unit string, e.g. "B"
sep:: separator string, e.g. " "
return human readable string, e.g. "1.21 KB"

C++ defination code:

std::string bytes_to_human(unsigned long long bytes, int precision = 2, int base = 1024, const std::string &unit = "B", const std::string &sep = " ")

cpu_freq

def cpu_freq() -> dict[str, int]

Get CPU frequency

item description
return CPU frequency, dict type, e.g. {"cpu0": 1000000000, "cpu1": 1000000000}

C++ defination code:

std::map<std::string, unsigned long> cpu_freq()

cpu_temp

def cpu_temp() -> dict[str, float]

Get CPU temperature

item description
return CPU temperature, unit dgree, dict type, e.g. {"cpu": 50.0, "cpu0": 50, "cpu1": 50}

C++ defination code:

std::map<std::string, float> cpu_temp()

cpu_usage

def cpu_usage() -> dict[str, float]

Get CPU usage

item description
return CPU usage, dict type, e.g. {"cpu": 50.0, "cpu0": 50, "cpu1": 50}

C++ defination code:

std::map<std::string, float> cpu_usage()

npu_freq

def npu_freq() -> dict[str, int]

Get NPU frequency

item description
return NPU frequency, dict type, e.g. {"npu0": 500000000}

C++ defination code:

std::map<std::string, unsigned long> npu_freq()

disk_usage

def disk_usage(path: str = '/') -> dict[str, int]

Get disk usage

item description
param path:: disk path, default "/"
return disk usage, dict type, e.g. {"total": 1024, "used": 512}

C++ defination code:

std::map<std::string, unsigned long long> disk_usage(const std::string &path = "/")

disk_partitions

def disk_partitions(only_disk: bool = True) -> list[dict[str, str]]

Get disk partition and mount point info

item description
param only_disk: only return real disk, tempfs sysfs etc. not return, default true.
return disk partition and mount point info, list type, e.g. [{"device": "/dev/mmcblk0p1", "mountpoint": "/mnt/sdcard", "fstype": "vfat"}]

C++ defination code:

std::vector<std::map<std::string, std::string>> disk_partitions(bool only_disk = true)

register_default_signal_handle

register default signal handle

C++ defination code:

void register_default_signal_handle()

poweroff

def poweroff() -> None

Power off device

C++ defination code:

void poweroff()

reboot

def reboot() -> None

Power off device and power on

C++ defination code:

void reboot()

Class