@esp-vision/device-cli 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/DEVICE_CORE_NOTICE.md +13 -0
  2. package/README.md +8 -2
  3. package/THIRD_PARTY_NOTICES.md +25 -5
  4. package/dist/device-cli.mjs +20104 -7753
  5. package/dist/native/LICENSE +21 -0
  6. package/dist/native/bindings.cjs +1860 -0
  7. package/dist/native/koffi/LICENSE.txt +22 -0
  8. package/dist/native/koffi/build/koffi/linux_arm64/koffi.node +0 -0
  9. package/dist/native/koffi/build/koffi/linux_armhf/koffi.node +0 -0
  10. package/dist/native/koffi/build/koffi/linux_ia32/koffi.node +0 -0
  11. package/dist/native/koffi/build/koffi/linux_loong64/koffi.node +0 -0
  12. package/dist/native/koffi/build/koffi/linux_riscv64d/koffi.node +0 -0
  13. package/dist/native/koffi/build/koffi/linux_x64/koffi.node +0 -0
  14. package/dist/native/koffi/build/koffi/musl_arm64/koffi.node +0 -0
  15. package/dist/native/koffi/build/koffi/musl_x64/koffi.node +0 -0
  16. package/dist/native/koffi/index.js +634 -0
  17. package/dist/native/koffi/package.json +38 -0
  18. package/dist/native/koffi/src/cnoke/LICENSE.txt +22 -0
  19. package/dist/native/koffi/vendor/node-addon-api/LICENSE.md +9 -0
  20. package/dist/native/koffi/vendor/node-api-headers/LICENSE +21 -0
  21. package/dist/native/package.json +1 -0
  22. package/dist/native/prebuilds/android-arm/@serialport+bindings-cpp.armv7.node +0 -0
  23. package/dist/native/prebuilds/android-arm64/@serialport+bindings-cpp.armv8.node +0 -0
  24. package/dist/native/prebuilds/darwin-x64+arm64/@serialport+bindings-cpp.node +0 -0
  25. package/dist/native/prebuilds/linux-arm/@serialport+bindings-cpp.armv6.glibc.node +0 -0
  26. package/dist/native/prebuilds/linux-arm/@serialport+bindings-cpp.armv7.glibc.node +0 -0
  27. package/dist/native/prebuilds/linux-arm/@serialport+bindings-cpp.armv7.musl.node +0 -0
  28. package/dist/native/prebuilds/linux-arm64/@serialport+bindings-cpp.armv8.glibc.node +0 -0
  29. package/dist/native/prebuilds/linux-arm64/@serialport+bindings-cpp.armv8.musl.node +0 -0
  30. package/dist/native/prebuilds/linux-x64/@serialport+bindings-cpp.glibc.node +0 -0
  31. package/dist/native/prebuilds/linux-x64/@serialport+bindings-cpp.musl.node +0 -0
  32. package/dist/native/prebuilds/win32-arm64/@serialport+bindings-cpp.armv8.node +0 -0
  33. package/dist/native/prebuilds/win32-ia32/@serialport+bindings-cpp.node +0 -0
  34. package/dist/native/prebuilds/win32-x64/@serialport+bindings-cpp.node +0 -0
  35. package/licenses/atob-lite-LICENSE.md +18 -0
  36. package/licenses/debug-LICENSE +20 -0
  37. package/licenses/esptool-js-LICENSE +202 -0
  38. package/licenses/koffi-LICENSE.txt +22 -0
  39. package/licenses/ms-license.md +21 -0
  40. package/licenses/node-addon-api-LICENSE.md +9 -0
  41. package/licenses/node-gyp-build-LICENSE +21 -0
  42. package/licenses/pako-LICENSE +21 -0
  43. package/licenses/serialport__bindings-cpp-LICENSE +21 -0
  44. package/licenses/serialport__bindings-interface-LICENSE +21 -0
  45. package/licenses/serialport__parser-delimiter-LICENSE +21 -0
  46. package/licenses/serialport__parser-readline-LICENSE +21 -0
  47. package/package.json +9 -2
  48. package/dist/node_rom.py +0 -64
  49. package/dist/node_serial.py +0 -77
package/dist/node_rom.py DELETED
@@ -1,64 +0,0 @@
1
- # SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
2
- # SPDX-License-Identifier: Apache-2.0
3
- """Internal JSON-line process adapter to separately installed esptool (GPL)."""
4
- import base64
5
- import contextlib
6
- import json
7
- import sys
8
-
9
-
10
- def main():
11
- with contextlib.redirect_stdout(sys.stderr):
12
- import esptool
13
- major, minor = map(int, esptool.__version__.split('.')[:2])
14
- if major != 5 or minor < 3:
15
- raise RuntimeError('Install esptool>=5.3,<6')
16
- esp = None
17
- families = {'ESP32-P4': 0x3280, 'ESP32-S3': 0x3253, 'ESP32-S31': 0x3231}
18
- try:
19
- for line in sys.stdin:
20
- request = json.loads(line)
21
- try:
22
- with contextlib.redirect_stdout(sys.stderr):
23
- method, args = request['method'], request.get('args', [])
24
- result = None
25
- if method == 'initialize':
26
- esp = esptool.detect_chip(port=sys.argv[1])
27
- result = {'chipFamily': families.get(esp.CHIP_NAME), 'chipRevision': esp.get_chip_revision()}
28
- elif method == 'security':
29
- security = esp.get_security_info()
30
- result = {'flags': security['flags'], 'flashCryptCnt': security['flash_crypt_cnt']}
31
- elif method == 'stub':
32
- esp = esptool.run_stub(esp)
33
- esptool.attach_flash(esp)
34
- esp.change_baud(460800)
35
- elif method == 'flashId':
36
- result = esp.flash_id()
37
- elif method == 'read':
38
- result = base64.b64encode(esp.read_flash(*args)).decode('ascii')
39
- elif method == 'write':
40
- offset, encoded = args
41
- data = base64.b64decode(encoded, validate=True)
42
- esptool.write_flash(esp, [(offset, data)], flash_mode='keep', flash_freq='keep', flash_size='keep', compress=True)
43
- elif method == 'readRegister':
44
- result = esp.read_reg(args[0])
45
- elif method == 'writeRegister':
46
- esp.write_reg(args[0], args[1], args[2])
47
- elif method == 'reset':
48
- esp.hard_reset()
49
- else:
50
- raise ValueError('Unknown ROM adapter method')
51
- print(json.dumps({'id': request['id'], 'result': result}), flush=True)
52
- except Exception as error:
53
- print(json.dumps({'id': request['id'], 'error': 'ROM_OPERATION_FAILED', 'method': request['method'], 'detail': str(error)}), flush=True)
54
- finally:
55
- if esp is not None:
56
- esp._port.close()
57
-
58
-
59
- if __name__ == '__main__':
60
- try:
61
- main()
62
- except Exception:
63
- print(json.dumps({'error': 'ESPTOOL_UNAVAILABLE'}), flush=True)
64
- sys.exit(1)
@@ -1,77 +0,0 @@
1
- # SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
2
- # SPDX-License-Identifier: Apache-2.0
3
- """Optional pyserial byte bridge. No EV-MUX or device operations live here."""
4
- import json
5
- import os
6
- import signal
7
- import sys
8
- import threading
9
-
10
- import serial
11
-
12
-
13
- def _configure_serial_exclusive(port, platform=os.name):
14
- # pyserial implements this as a non-blocking advisory lock on POSIX. The
15
- # Windows backend does not support this option, so leave its behavior alone.
16
- if platform == 'posix':
17
- port.exclusive = True
18
-
19
-
20
- def main():
21
- if sys.argv[1] == '--list':
22
- from serial.tools.list_ports import comports
23
- print(json.dumps([{'path': p.device, 'manufacturer': p.manufacturer,
24
- 'product': p.product, 'serialNumber': p.serial_number,
25
- 'vendorId': p.vid, 'productId': p.pid,
26
- 'location': p.location, 'hwid': p.hwid} for p in comports()]))
27
- return
28
- port = serial.Serial(port=None, baudrate=115200, timeout=0.01, write_timeout=2)
29
- # Configure before open to avoid deliberately asserting reset/boot straps.
30
- port.rts = False
31
- port.dtr = True
32
- port.port = sys.argv[1]
33
- _configure_serial_exclusive(port)
34
- stopped = threading.Event()
35
-
36
- def terminate(*_args):
37
- raise SystemExit(0)
38
-
39
- def receive():
40
- try:
41
- while not stopped.is_set():
42
- data = port.read(8192)
43
- if data:
44
- offset = 0
45
- while offset < len(data):
46
- offset += os.write(1, data[offset:])
47
- except (OSError, serial.SerialException):
48
- if not stopped.is_set():
49
- os._exit(2)
50
-
51
- signal.signal(signal.SIGTERM, terminate)
52
- signal.signal(signal.SIGINT, terminate)
53
- try:
54
- port.open()
55
- thread = threading.Thread(target=receive, daemon=True)
56
- thread.start()
57
- print('READY', file=sys.stderr, flush=True)
58
- while data := sys.stdin.buffer.read1(8192):
59
- offset = 0
60
- while offset < len(data):
61
- written = port.write(data[offset:])
62
- if not written:
63
- raise OSError('Zero-byte serial write')
64
- offset += written
65
- finally:
66
- stopped.set()
67
- port.close()
68
-
69
-
70
- if __name__ == '__main__':
71
- try:
72
- main()
73
- except Exception as error:
74
- text = str(error).lower()
75
- code = 'SERIAL_ACCESS_DENIED' if ('permission denied' in text or 'access is denied' in text or 'access denied' in text) else 'SERIAL_BUSY' if ('resource busy' in text or 'resource temporarily unavailable' in text or 'exclusively lock' in text) else 'SERIAL_ERROR'
76
- print(code, file=sys.stderr, flush=True)
77
- sys.exit(2)