From f0c1eac02f9c917267a8bb968060762f0de99967 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 7 Nov 2022 10:37:31 -0600 Subject: Simplify MTAC-ETH AP2 device rename to eth2 --- .../udev/eudev/mtcdt/accessory_ethernet.rules | 42 +++++++++----------- recipes-core/udev/eudev/mtcdt/mtcdt_eth_rename.sh | 46 ---------------------- recipes-core/udev/eudev_%.bbappend | 5 +-- 3 files changed, 19 insertions(+), 74 deletions(-) delete mode 100755 recipes-core/udev/eudev/mtcdt/mtcdt_eth_rename.sh diff --git a/recipes-core/udev/eudev/mtcdt/accessory_ethernet.rules b/recipes-core/udev/eudev/mtcdt/accessory_ethernet.rules index 5426544..64739e0 100644 --- a/recipes-core/udev/eudev/mtcdt/accessory_ethernet.rules +++ b/recipes-core/udev/eudev/mtcdt/accessory_ethernet.rules @@ -1,28 +1,22 @@ +ACTION!="add|change|move", GOTO="mlinux_end" +SUBSYSTEM!="net", GOTO="mlinux_end" +# +# Cannot always get driver test to work. +#ENV{DRIVER}!="smsc75xx", GOTO="mlinux_end" +#DRIVERS!="smsc75xx", GOTO="mlinux_end" + #To add new rule for new device you have to run (in case if you want to add eth1 interface) #admin@mtcdt:~# udevadm info --attribute-walk --path=/sys/class/net/eth1 -# looking at device '/devices/ahb.0/700000.ehci/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1:1.0/net/eth1': -# KERNEL=="eth1" -# SUBSYSTEM=="net" -# DRIVER=="" -# ATTR{mtu}=="1500" -# ATTR{type}=="1" -# ........... -# ........... - -# looking at parent device '/devices/ahb.0/700000.ehci/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1:1.0': -# KERNELS=="1-2.1.1:1.0" <------------------- extract this record to add to the rule -# SUBSYSTEMS=="usb" -# DRIVERS=="smsc75xx" -# ATTRS{bInterfaceClass}=="ff" -# ATTRS{bInterfaceSubClass}=="00" -# ........... - -# Four port to four port hub case -# 1-2.1:1.0 eth1 (Only in four port case) -# 1-2.2:1.0 eth2 (Matches eth1 in the two port case) # -# Four port to two port hub case -# 1-2.2:1.0 eth1 (matches eth2 in the four port case) -# 1-2.3:1.0 eth2 (only in two port case) +# Because ID_PATH is the same for two different cases in the two port hub case, and +# the original MTCDT hub layout, we must use the entire device path. Only eth1 needs +# to be renamed. # -SUBSYSTEMS=="usb", DRIVERS=="smsc75xx", RUN+="/etc/udev/scripts/mtcdt_eth_rename.sh" +# Two port hub case: +# Some MTCDTIP-0.1: +ENV{DEVPATH}=="/devices/platform/ahb/700000.ehci/usb1/1-2/1-2.3/1-2.3:1.0/net/eth1", NAME="eth2" +# MTCDT-0.0 and MTCDT-0.1: +ENV{DEVPATH}=="/devices/platform/ahb/700000.ehci/usb1/1-2/1-2.2/1-2.2:1.0/net/eth1", NAME="eth2" +# MTCDT-0.2: +ENV{DEVPATH}=="/devices/platform/ahb/700000.ehci/usb1/1-2/1-2.1/1-2.1.2/1-2.1.2:1.0/net/eth1", NAME="eth2" +LABEL="mlinux_end" diff --git a/recipes-core/udev/eudev/mtcdt/mtcdt_eth_rename.sh b/recipes-core/udev/eudev/mtcdt/mtcdt_eth_rename.sh deleted file mode 100755 index 4273d30..0000000 --- a/recipes-core/udev/eudev/mtcdt/mtcdt_eth_rename.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -I2C_DIR="/sys/bus/i2c/devices" - -AP1_EEPROM="$I2C_DIR/1-0050/eeprom" -AP2_EEPROM="$I2C_DIR/1-0052/eeprom" -hw_version1='' -hw_version2='' - -if [[ -f $AP1_EEPROM ]] ; then - hw_version1=$(mts-id-eeprom --accessory-card --in-file "$AP1_EEPROM" 2>/dev/null | grep '^hw-version:') -fi -if [[ -f $AP2_EEPROM ]] ; then - hw_version2=$(mts-id-eeprom --accessory-card --in-file "$AP2_EEPROM" 2>/dev/null | grep '^hw-version:') -fi - -AP1=0 -AP2=0 - -if [[ $hw_version1 =~ ^hw-version:[[:space:]]*\"MTAC-ETH ]] ; then - AP1=1 -fi - -if [[ $hw_version2 =~ ^hw-version:[[:space:]]*\"MTAC-ETH ]] ; then - AP2=1 -fi - -if ((AP1 == 0)) && ((AP2 == 1)) ; then - if ip addr show eth1 >/dev/null 2>&1 && ! ip addr show eth2 >/dev/null 2>&1 ; then - ip link set eth1 name eth2 - fi -fi - -# Handle the case where we are coming out of reset. -# udev will assign eth# where # is the first open slot starting from zero. -# We assing by AP slot here. -if ((AP1 == 1)) && ((AP2 == 1)) ; then - if (($(mts-io-sysfs show ap2/reset) == 0)) ; then - : - # Nothing to do if ap2 is in reset. - elif (($(mts-io-sysfs show ap1/reset) == 0)) ; then - if ip addr show eth1 >/dev/null 2>&1 && ! ip addr show eth2 >/dev/null 2>&1 ; then - ip link set eth1 name eth2 - fi - fi -fi diff --git a/recipes-core/udev/eudev_%.bbappend b/recipes-core/udev/eudev_%.bbappend index 772ab33..0602568 100644 --- a/recipes-core/udev/eudev_%.bbappend +++ b/recipes-core/udev/eudev_%.bbappend @@ -1,16 +1,13 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -PR .= ".mlinux12" +PR .= ".mlinux13" SRC_URI_append_mtcdt = " \ file://accessory_ethernet.rules \ - file://mtcdt_eth_rename.sh \ file://mtcdt-atmel-serial.rules \ " do_install_append_mtcdt() { install -m 644 ${WORKDIR}/accessory_ethernet.rules ${D}${sysconfdir}/udev/rules.d/ install -m 644 ${WORKDIR}/mtcdt-atmel-serial.rules ${D}${sysconfdir}/udev/rules.d/ - install -d 755 ${D}${sysconfdir}/udev/scripts/ - install -m 755 ${WORKDIR}/mtcdt_eth_rename.sh ${D}${sysconfdir}/udev/scripts/ } -- cgit v1.2.3