@@ -1407,11 +1407,11 @@ function ver() {
14071407
14081408# Check if a specific hexadecimal address exists on the I2C bus.
14091409# Takes an argument like "2f" which is converted to "0x2f".
1410- # Only used when a Raspberry Pi board is detected.
1410+ # By default only the primary I2C bus is probed; additional buses must be
1411+ # explicitly requested through OVOS_I2C_SCAN_BUSES.
14111412function i2c_get() {
14121413 local address=" $1 "
14131414 local bus=" "
1414- local bus_dev=" "
14151415 local -a i2c_buses=()
14161416 local override_buses=" ${OVOS_I2C_SCAN_BUSES:- } "
14171417
@@ -1424,19 +1424,7 @@ function i2c_get() {
14241424 # Accept either comma- or space-separated values.
14251425 read -r -a i2c_buses <<< " ${override_buses//,/ }"
14261426 else
1427- if [ -n " ${I2C_BUS:- } " ]; then
1428- i2c_buses+=(" $I2C_BUS " )
1429- fi
1430-
1431- for bus_dev in /dev/i2c-* ; do
1432- [ -e " $bus_dev " ] || continue
1433- bus=" ${bus_dev##* -} "
1434- [[ " $bus " =~ ^[0-9]+$ ]] || continue
1435-
1436- if [ " $bus " != " ${I2C_BUS:- } " ]; then
1437- i2c_buses+=(" $bus " )
1438- fi
1439- done
1427+ i2c_buses+=(" ${I2C_BUS:- 1} " )
14401428 fi
14411429
14421430 for bus in " ${i2c_buses[@]} " ; do
@@ -1480,15 +1468,6 @@ function i2c_scan() {
14801468 fi
14811469 done
14821470
1483- # If the live scan does not detect any supported devices during an
1484- # existing-install rerun, recover the last known I2C device list from
1485- # installer state to keep Mark II/DevKit gating deterministic.
1486- if [ " ${EXISTING_INSTANCE:- false} " == " true" ] && \
1487- ! has_detected_device " atmega328p" && \
1488- ! has_detected_device " attiny1614" && \
1489- ! has_detected_device " tas5806" ; then
1490- restore_detected_devices_from_state || true
1491- fi
14921471 echo -e " [$done_format ]"
14931472 fi
14941473
@@ -1513,44 +1492,6 @@ function has_detected_device() {
15131492 return 1
15141493}
15151494
1516- # Restore known I2C devices from installer state when live probing did not
1517- # detect anything (for example, re-runs after partial installs).
1518- function restore_detected_devices_from_state() {
1519- local run_as_home=" ${RUN_AS_HOME:- } "
1520- local state_file=" ${INSTALLER_STATE_FILE:- } "
1521- local cached_device=" "
1522- local restored_device=" false"
1523-
1524- if [ -z " $state_file " ]; then
1525- if [ -z " $run_as_home " ]; then
1526- return 1
1527- fi
1528- state_file=" ${run_as_home} /.local/state/ovos/installer.json"
1529- fi
1530-
1531- if [ ! -f " $state_file " ] || ! command -v jq & >> " $LOG_FILE " ; then
1532- return 1
1533- fi
1534-
1535- while IFS= read -r cached_device; do
1536- case " $cached_device " in
1537- atmega328p | attiny1614 | tas5806)
1538- if ! has_detected_device " $cached_device " ; then
1539- DETECTED_DEVICES+=(" $cached_device " )
1540- restored_device=" true"
1541- fi
1542- ;;
1543- esac
1544- done < <( jq -r ' .i2c_devices[]? // empty' " $state_file " 2>> " $LOG_FILE " )
1545-
1546- if [ " $restored_device " == " true" ]; then
1547- printf ' %s\n' " [info] Restored detected I2C devices from installer state: ${DETECTED_DEVICES[*]} " & >> " $LOG_FILE "
1548- return 0
1549- fi
1550-
1551- return 1
1552- }
1553-
15541495# Returns success for Mark II/DevKit family hardware (tas5806 present).
15551496function is_mark2_or_devkit_detected() {
15561497 has_detected_device " tas5806"
0 commit comments