mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-13 15:11:20 +10:00
Merge branch 'develop' into pioarduino
This commit is contained in:
@@ -494,10 +494,17 @@ void portduinoSetup()
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
char serial[9] = {0};
|
||||
ch341Hal->getSerialString(serial, 8);
|
||||
// Pass the full buffer size (9 = 8 chars + null) to getSerialString,
|
||||
// not 8. The function treats `len` as buffer size and reserves one
|
||||
// slot for the null terminator, so passing 8 produced a 7-char serial
|
||||
// and broke the `strlen(serial) == 8` check below — masked on Linux
|
||||
// by the BlueZ HCI MAC fallback in getMacAddr(), but on macOS (where
|
||||
// the BlueZ path is __linux__-guarded) it left mac_address empty and
|
||||
// meshtasticd refused to start.
|
||||
ch341Hal->getSerialString(serial, sizeof(serial));
|
||||
std::cout << "CH341 Serial " << serial << std::endl;
|
||||
char product_string[96] = {0};
|
||||
ch341Hal->getProductString(product_string, 95);
|
||||
ch341Hal->getProductString(product_string, sizeof(product_string));
|
||||
std::cout << "CH341 Product " << product_string << std::endl;
|
||||
if (strlen(serial) == 8 && portduino_config.mac_address.length() < 12) {
|
||||
std::cout << "Deriving MAC address from Serial and Product String" << std::endl;
|
||||
|
||||
@@ -133,6 +133,39 @@ test_testing_command =
|
||||
; SOCK_NONBLOCK fallback, Common.h __APPLE__ guard, WiFiServer.cpp extern-C
|
||||
; fix, package.json URL refresh. Pulled by platform-native at its pinned commit.
|
||||
; This env therefore only carries the firmware-side build flags and src filter.
|
||||
;
|
||||
; Real LoRa hardware on macOS:
|
||||
; The same lib_dep `pine64/libch341-spi-userspace` used on Linux works on
|
||||
; macOS as-is — its `libusb_detach_kernel_driver()` call is `__linux__`-
|
||||
; guarded, but on macOS the kernel doesn't bind a driver to a CH341A SPI
|
||||
; bridge (PID 0x5512; bDeviceClass=0xff vendor-specific) by default, so
|
||||
; no detach is needed. Apple's bundled CH34x driver targets the CH340
|
||||
; *UART* variant (PID 0x7523) — different product. libusb opens the device
|
||||
; and claims interface 0 directly via IOUSBHostInterface.
|
||||
;
|
||||
; To use, point `meshtasticd` at any of the existing `bin/config.d/lora-*.yaml`
|
||||
; files that specify `spidev: ch341` — they're platform-agnostic. Example:
|
||||
; pio run -e native-macos
|
||||
; mkdir -p ~/.meshtasticd && cp bin/config-dist.yaml ~/.meshtasticd/config.yaml
|
||||
; # Edit ~/.meshtasticd/config.yaml: ConfigDirectory: ./config.d/
|
||||
; mkdir ~/.meshtasticd/config.d && cp bin/config.d/lora-meshstick-1262.yaml ~/.meshtasticd/config.d/
|
||||
; cd ~/.meshtasticd && /path/to/firmware/.pio/build/native-macos/meshtasticd
|
||||
;
|
||||
; The MAC address auto-derives from the CH341's USB serial + product string
|
||||
; (PortduinoGlue.cpp ~497-518); on Linux a BlueZ HCI socket is the fallback
|
||||
; when that path isn't taken, but BlueZ is `__linux__`-guarded so the
|
||||
; serial-derivation path is mandatory on macOS. Override with
|
||||
; `MACAddress: AA:BB:CC:DD:EE:FF` in config.yaml's `General:` section if
|
||||
; the device's serial isn't 8 hex chars.
|
||||
;
|
||||
; Diagnosing CH341 issues on macOS:
|
||||
; ioreg -p IOUSB -l -w 0 | grep -B2 -A30 0x5512
|
||||
; Children should be `IOUSBHostInterface`. If a vendor driver class
|
||||
; (e.g. `com.wch.CH34xVCPDriver` from a third-party WCH installer)
|
||||
; claims interface 0, libusb will fail with LIBUSB_ERROR_BUSY.
|
||||
; Workaround: `sudo kmutil unload -b <bundleID>`.
|
||||
; LIBUSB_DEBUG=4 .pio/build/native-macos/meshtasticd
|
||||
; Verbose libusb trace — useful when claim_interface fails.
|
||||
; ---------------------------------------------------------------------------
|
||||
[env:native-macos]
|
||||
extends = native_base
|
||||
|
||||
Reference in New Issue
Block a user