-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use dd command instead of test command to wait the Serial device #297
base: master
Are you sure you want to change the base?
Conversation
Forum topic has been created to discuss this |
Its unclear from that thread if anyone else has confirmed whether this change is OK. The last comment from danielef seems to suggest it needs the sleep that you commented out in the code posted to the forum. I'm not in a position to test this as all my mac's are old and not updateable to the current versions of MacOs |
Today I tested this dd modification on latest macOS (10.13) and latest Arduino IDE (1.8.5). I had thought that the dd mod may not be required on the latest OS. But it was still required. Opening the device fails randomly if test -c /dev/cu.XXX returns successfully. The error is "resource busy". And I had to extend timeout of the generic_boot20_pc13.bin. That was too short. The dfu-util always fails with the default timeout duration. I'm afraid that no one use this configuration on mac except me. |
I added one more wait loop after upload-reset (0c9aab8) because I found that the new macOS required longer duration to list the target device. I tried various wait argument 750, 1000, 1250... of upload-reset to find 4,000ms seems to be enough. But it was too long to wait for 4 seconds every time before uploading. |
@hanyazou seems like your PR includes a lot of unrelated commits, quite a good bunch of them. |
0c9aab8
to
1902867
Compare
@victorpv thank you for the comment. I've used 'git rebase' on the branch on Oct 22. The rebase took many commits from the master into my branch. I re-created branch in the same name to cleanup. |
Now looks nice with a single change :) |
tools/macosx/maple_upload
Outdated
@@ -55,7 +55,7 @@ ${DFU_UTIL} -d ${usbID} -a ${altID} -D ${binfile} -R ${dfuse_addr} -R | |||
echo -n Waiting for ${dummy_port_fullpath} serial... | |||
|
|||
COUNTER=0 | |||
while [ ! -c ${dummy_port_fullpath} ] && ((COUNTER++ < 40)); do | |||
while ! dd if=${dummy_port_fullpath} of=/dev/null count=0 > /dev/null 2>&1 && ((COUNTER++ < 40)); do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Can you please explain why using dd is better than a built-in check (
test -c
)? I mean, device existence should be enough, there's no need to try opening it for reading. -
The same change is needed for linux (at least).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I mean, device existence should be enough, there's no need to try opening it for reading.
Because it does not have read permission though the device exist or you can't open the device for read though it have read permission. Please note that some device driver might return EACCESS on open operation even if the device entry on the file system have the permission.
- The same change is needed for linux (at least).
I can't test that modification because I don't have Linux PC. If you get device open error on your Linux, please try this patch.
discussed in the topic "Failed to reconnect serial monitor after uploading on macOS" at http://stm32duino.com/viewtopic.php?f=21&t=2050