<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Dan,
<br>
<br>
thanks for your very detailled feedback (I really do appriciate
that). Hopefully I did it all right except for two items:
<br>
<br>
<br>
<blockquote type="cite" style="color: #000000;">
<blockquote type="cite" style="color: #000000;">+def
_r2_enter_programming_mode(radio):
<br>
+ serial = radio.pipe
<br>
+
<br>
+ magic = "TYOGRAM"
<br>
+ exito = False
<br>
+ serial.write(CMD_STX)
<br>
+ for i in range(0, 5):
<br>
+ for j in range(0, len(magic)):
<br>
+ serial.write(magic[j])
<br>
+ ack = serial.read(1)
<br>
+
<br>
+ try:
<br>
+ if ack == CMD_ACK:
<br>
+ exito = True
<br>
+ break
<br>
+ except:
<br>
+ LOG.debug("Attempt #%s, failed, trying again" % i)
<br>
+ pass
<br>
</blockquote>
I don't think there's anything in this try..except block that can
raise, so I would just remove it.
<br>
</blockquote>
<br>
No that should stay in there as we do expect to receive an ACK from
the radio upon sending TYGRAM to the radio.
<br>
<blockquote type="cite" style="color: #000000;">
<blockquote type="cite" style="color: #000000;">+
<br>
+ # check if we had EXITO
<br>
+ if exito is False:
<br>
+ msg = "The radio did not accept program mode after five
tries.\n"
<br>
+ msg += "Check you interface cable and power cycle your
radio."
<br>
+ raise errors.RadioError(msg)
<br>
+
<br>
+ try:
<br>
+ serial.write(CMD_STX)
<br>
+ ident = serial.read(8)
<br>
+ except:
<br>
+ _r2_exit_programming_mode(radio)
<br>
+ raise errors.RadioError("Error communicating with
radio")
<br>
+
<br>
+ # No idea yet what the next 7 bytes stand for
<br>
+ # as long as they start with ACK we are fine
<br>
+ if not ident.startswith(CMD_ACK):
<br>
+ _r2_exit_programming_mode(radio)
<br>
+ LOG.debug(util.hexprint(ident))
<br>
+ raise errors.RadioError("Radio returned unknown
identification string")
<br>
+
<br>
+ try:
<br>
+ serial.write(CMD_ACK)
<br>
+ ack = serial.read(1)
<br>
+ except:
<br>
+ _r2_exit_programming_mode(radio)
<br>
</blockquote>
It would probably be best to wrap this function in something that
always tries to exit programming mode if it raises so you don't
need to have it on all the exit paths. Something like
<br>
<br>
def _r2_enter_programming_mode(radio):
<br>
try:
<br>
return _really_enter(radio)
<br>
except:
<br>
_r2_exit_programming_mode(radio)
<br>
raise # will re-raise the original error
<br>
</blockquote>
<br>
I will bare that in mind but due to the fact that I am really an
absolute beginner to Python I would like to postpone the requested
update for later. Hopefully that is OK for you. Promissed: I will
later on try to get that done as suggested!
<br>
<br>
<blockquote type="cite" style="color: #000000;">
<blockquote type="cite" style="color: #000000;">diff --git
a/tests/images/Radioddity_R2.img
b/tests/images/Radioddity_R2.img
<br>
new file mode 100644
<br>
index
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0bbd8468beda1c4f90b1be24385a530da662c710<br>
GIT binary patch
<br>
literal 1181
<br>
zc%1Ez&1!={6h>{KK0}w?WS`nva2dQPBZPt>@n<!o1T$({X*&e7>$=OlXCI;V-kDit
<br>
z({&-2bHM92&WGwGK%o<kLT4@qQt#@PBS7kXcFz$YO&)RtNRw|k0;I`z90AhgpBw?w
<br>
z<R^{*X>wN}K-zwR0BQRL0;KI12#~g4AVAuFfdFay1p=h)7wYW)FLRmyG+#H4>p0W3
<br>
zUVi>QpL%zCoT=W)x8Ymv8|P{}CSIBOUG>1^vs}paKI%jkbY<Mnw=4F}!sMg!(!L7W
<br>
z6F#q&Qon0O+>dn>cx9d(@w{T~Ys1=wT8@v0GTwMh9vb$Nv{f7(>(P8$Wa)r+bs|sw
<br>
Vb!+!g-{%#1G8CCV*Z0UI_yseAoGAbR
<br>
</blockquote>
This looks like maybe you committed the image in a previous
changeset and then just tweaked it in this one? Either add it in
the same patch, or you can attach it to the issue you create and I
can snag it from there.
<br>
</blockquote>
<br>
I binary attached it to issue #6063
<br>
<br>
<blockquote type="cite" style="color: #000000;">Also, I know you
said you were having trouble running the style checks on windows,
so I have included the output of it for you at the end here.
<br>
</blockquote>
<br>
Thanks. That helped quite a lot.
<br>
<br>
<blockquote type="cite" style="color: #000000;">Otherwise this looks
really close, thanks! I'd like to get the image so I can run the
tests and get as much of the style and other nits above cleaned up
and then I'm good with it.
<br>
</blockquote>
<br>
If I did it all right, the updated/patched version should already
be received by your system.
<br>
<br>
Kind regards,<br>
Klaus<br>
</body>
</html>