Skip to content

Tentantive fix to serial port enumeration issues on MacOSX #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 2, 2023

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Dec 14, 2022

This is a tentative fix for #51

@kittaakos kittaakos self-requested a review December 14, 2022 16:29
Copy link

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I manually verified the changes.

I copied the serial-discover (serial-discovery Version: git-snapshot Commit: fc8b205 Date: 2022-12-19T07:11:52Z) to ~/Library/Arduino15/packages/builtin/tools/serial-discovery/1.3.2. I have 1.3.2 version only:

ls -al ~/Library/Arduino15/packages/builtin/tools/serial-discovery      
total 0
drwxr-xr-x  3 a.kitta  staff   96 Dec 19 08:13 .
drwxr-xr-x  6 a.kitta  staff  192 Oct  5 14:21 ..
drwxr-xr-x  4 a.kitta  staff  128 Oct  5 14:21 1.3.2
ls -al ~/Library/Arduino15/packages/builtin/tools/serial-discovery/1.3.2                   
total 6216
drwxr-xr-x  4 a.kitta  staff      128 Oct  5 14:21 .
drwxr-xr-x  3 a.kitta  staff       96 Dec 19 08:13 ..
-rw-r--r--  1 a.kitta  staff    35149 Oct  5 14:21 LICENSE.txt
-rwxr-xr-x  1 a.kitta  staff  2845608 Dec 19 08:15 serial-discovery

I did ~50 consecutive uploads in IDE2, and the discovery never missed detecting the board after the upload.

I have noticed that IDE2 failed to reconnect to the board after an upload when the port has changed, but this is out of the context of this PR.

{
  "type": "add",
  "address": "/dev/cu.usbmodem2",
  "label": "/dev/cu.usbmodem2",
  "protocol": "serial",
  "protocol_label": "Serial Port (USB)",
  "properties": {
    "pid": "0x005A",
    "serialNumber": "0000000000000000131B9378799A643D",
    "vid": "0x2341"
  },
  "boards": [
    {
      "name": "Arduino Nano 33 BLE",
      "fqbn": "arduino:mbed_nano:nano33ble"
    }
  ]
}
{
  "type": "remove",
  "address": "/dev/cu.usbmodem2",
  "protocol": "serial",
  "properties": {}
}
{
  "type": "add",
  "address": "/dev/cu.usbmodem3",
  "label": "/dev/cu.usbmodem3",
  "protocol": "serial",
  "protocol_label": "Serial Port (USB)",
  "properties": {
    "pid": "0x805A",
    "serialNumber": "131B9378799A643D",
    "vid": "0x2341"
  },
  "boards": [
    {
      "name": "Arduino Nano 33 BLE",
      "fqbn": "arduino:mbed_nano:nano33ble"
    }
  ]
}

I do not know what this PR changes, but it works on my macOS (12.5.1) with the Arduino Nano 33 BLE board. Thank you!

@kittaakos
Copy link

Please note, that the port#properties#pid changes after an upload. I do not know if this is OK or expected.

@cmaglie
Copy link
Member Author

cmaglie commented Jan 2, 2023

Thanks for testing the patch @kittaakos!

Please note, that the port#properties#pid changes after an upload. I do not know if this is OK or expected.

This is expected the PID is different when the board runs the sketch (0x005A) and when runs the bootloader (0x805A).

@cmaglie cmaglie merged commit 70f428b into main Jan 2, 2023
@cmaglie cmaglie deleted the fix_macosx branch January 2, 2023 11:50
@cmaglie cmaglie self-assigned this Jan 2, 2023
@per1234 per1234 added topic: code Related to content of the project itself topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project and removed topic: code Related to content of the project itself labels Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants