print "$(<${path})"
}
+device_get_driver() {
+ local device="${1}"
+ assert isset device
+
+ get_driver_from_path "${SYS_CLASS_NET}/${device}/device/driver/module"
+}
+
# Check if the device is a bonding device
device_is_bonding() {
[ -d "/sys/class/net/${1}/bonding" ]
tr -sc [:alnum:] "-" < <(printf "%s" "${string,,}")
}
+
+get_driver_from_path() {
+ local path="${1}"
+
+ if file_exists "${path}"; then
+ # Resolve symlink
+ local driver="$(readlink "${path}")"
+
+ # Print module name
+ basename "${driver}"
+ return ${EXIT_OK}
+ fi
+
+ return ${EXIT_ERROR}
+}
cli_print_fmt1 1 "Status" "${status}"
cli_print_fmt1 1 "Type" "${type}"
+ # Print the driver name
+ local driver="$(device_get_driver "${device}")"
+ if isset driver; then
+ cli_print_fmt1 1 "Driver" "${driver}"
+ fi
+
# Ethernet-compatible?
device_is_ethernet_compatible "${device}" &>/dev/null
cli_print_fmt1 1 "Ethernet-compatible" "$(cli_print_bool $?)"
local address="$(phy_get_address "${phy}")"
cli_print_fmt1 1 "Address" "${address}"
+
+ # Show kernel module
+ local driver="$(phy_get_driver "${phy}")"
+ if isset driver; then
+ cli_print_fmt1 1 "Driver" "${driver}"
+ fi
+
cli_space
local devices="$(phy_get_devices "${phy}")"