cmsis_dap: Wait CMSIS-DAP MSD remount cycle to confirm successful programming

After CMSIS-DAP MSD finished programming firmware (either successfully or
not), it "unmounts" and "remounts" the USB MSD device (actually, issues
MSD "media changed" notifications). We now wait for "unmount" and following
"remount", and check for failure file, FAIL.TXT. If it's present, we dump
it and properly fail the operation (which for example allows parent LAVA
boot-retry action to try it again).

Note the detection of MSD unmount/remount requires issues FS sync commands
(which we now do on Python level using os.sync(), instead of calling
external "sync" command). (Commenting os.sync() calls is a way to trigger
failure behavior on hardware which is susceptible to it.)

Finally, while this new behavior is made default, a "skip_autoremount_wait"
option is added to revert to the old behavior (of just calling sync once and
waiting static delay). It can be set in a device dict for boards which may
turn out to have issues with new process.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
17 jobs for cmsis-dap-wait-remount in 15 minutes and 56 seconds (queued for 3 seconds)
Status Job ID Name Coverage
  Test
passed #119260
amd64
dispatcher-debian-10

00:02:11

passed #119262
amd64
dispatcher-debian-11

00:02:18

passed #119261
amd64
server-debian-10

00:02:53

passed #119263
amd64
server-debian-11

00:04:56

 
  Analyze
passed #119264
amd64-dind
bandit-sast

00:00:52

passed #119265
amd64
black

00:00:33

passed #119266
amd64
code_quality

00:00:20

passed #119271
amd64
codespell

00:00:16

passed #119267
amd64
coverage

00:06:29

60.88%
passed #119268
amd64
dockerfiles

00:00:15

passed #119270
amd64
pylint

00:03:03

passed #119269
amd64
schemas

00:00:28

 
  Build
passed #119273
amd64
debian/10

00:01:33

passed #119272
amd64
doc

00:00:36

passed #119276
amd64-dind
docker-amd64-dispatcher

00:01:42

passed #119275
amd64-dind
docker-amd64-server

00:02:45

failed #119274
amd64-dind
docker-amd64-dispatcher

01:00:01