RU.MAC------------------- < Пред. | След. > -- < @ > -- < Сообщ. > -- < Эхи > --
 Nп/п : 36 из 54
 От   : Dmitry Protasoff                    2:5001/100.1      04 ноя 25 14:00:08
 К    : Sergei Zhavoronkoff                                   04 ноя 25 17:07:02
 Тема : демон от su
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 2:5001/100.1 690a076d
@REPLY: 2:5015/46.47 690950ae
@CHRS: CP866 2
@TZUTC: 0000
@TID: hpt/mac 1.9 2024-03-02
Hello, Sergei!

Tuesday November 04 2025 04:02, you wrote to me:

 DP>> Hужно?
 SZ> Для общего развития)

 SZ> я вроде как победил первопричину) Костыль больше не требуется)

Как то так:

/usr/local/bin/fix-bluetooth.sh:
-+-
#!/bin/bash

LOG_FILE="/var/log/bluetooth-fix.log"

echo "$(date): ---- run ----" >> "$LOG_FILE"

# считаем аптайм, чтобы не писать в nvram бесконечно
boot_ts=$(sysctl -n kern.boottime | sed -E `s/.*sec = ([0-9]+).*/\\1/`)
now_ts=$(date +%s)
uptime=$((now_ts - boot_ts))

echo "$(date): Uptime: ${uptime}s" >> "$LOG_FILE"

# после 180 секунд просто выходим, ничего не трогаем
if [ "$uptime" -gt 180 ]; then
  echo "$(date): Uptime > 180s, skipping nvram write" >> "$LOG_FILE"
  exit 0
fi

 current=$(nvram -p 2>&1 | grep "bluetoothExternalDongleFailed" || echo
"not set")
echo "$(date): Before: $current" >> "$LOG_FILE"

# ВСЕГДА жёстко ставим нужное значение
nvram 7C436110-AB2A-4BBB-A880-FE41995C9F82:bluetoothExternalDongleFailed=%00
ret=$?
echo "$(date): nvram exit code: $ret" >> "$LOG_FILE"

new=$(nvram -p 2>&1 | grep "bluetoothExternalDongleFailed" || echo "not set")
echo "$(date): After: $new" >> "$LOG_FILE"
-+-

/Library/LaunchDaemons/com.user.bluetoothfix.plist:
-+-

  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">


    Label
    com.user.bluetoothfix

    ProgramArguments
    
        /usr/local/bin/fix-bluetooth.sh
    


    
    RunAtLoad
    

    
    StartInterval
    5

    StandardOutPath
    /var/log/bluetooth-fix.log

    StandardErrorPath
    /var/log/bluetooth-fix-error.log


-+-

Best regards,
             dp.

--- GoldED+/OSX 1.1.5-b20250409
 * Origin: All is good in St. John`s Wood (2:5001/100.1)
SEEN-BY: 4500/1 5001/3 100 5019/40 5020/101 545
715 848 1042 4441 12000
SEEN-BY: 5030/1081 5060/900
@PATH: 5001/100 5020/4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх