Class: Prremote::Detector
- Inherits:
-
Object
- Object
- Prremote::Detector
- Defined in:
- lib/prremote/detector.rb
Constant Summary collapse
- KNOWN_VENDORS =
Known USB vendor IDs → device label and the macOS port-name pattern. Pico exposes native USB CDC (usbmodem); ESP32 boards sit behind a USB-UART bridge (usbserial): CP210x on M5GO/M5Stack, CH910x on newer revisions.
{ '2e8a' => { label: 'Pico (prremote/R2P2)', macos: /usbmodem/ }, '10c4' => { label: 'ESP32 (CP210x)', macos: /usbserial/ }, '1a86' => { label: 'ESP32 (CH910x)', macos: /usbserial/ } }.freeze
- R2P2_VENDOR_IDS =
Raspberry Pi USB VID (kept for compat)
%w[2e8a].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find_device ⇒ Object
16 17 18 |
# File 'lib/prremote/detector.rb', line 16 def self.find_device new.find_device end |
Instance Method Details
#find_device ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/prremote/detector.rb', line 20 def find_device candidates = serial_ports return candidates.first if candidates.size == 1 known = candidates.select { |p| known_port?(p) } known.first || candidates.first end |
#list_devices ⇒ Object
28 29 30 31 32 |
# File 'lib/prremote/detector.rb', line 28 def list_devices serial_ports.map do |port| { port: port, label: port_label(port) || 'unknown' } end end |