# HG changeset patch # User Adam Novak # Date 1477543220 25200 # Wed Oct 26 21:40:20 2016 -0700 # Node ID 774834381fea0cb89e88058b70ffa48243032077 # Parent cc28502a220f297e56fa9d99e7ea74480e1cd15f [uv5r] Work around low DTR on pl2303 chips on modern Ubuntu. Fixes #4165 This makes the UV5R driver explicitly set DTR to 1 and wait a bit for the radio to stop trying to transmit and pay attention. DTR is defaulting to 0 when the port is closed on Ubuntu 16.04 with the stock pl2303-based programming cable that comes with the UV-82, and a low DTR activates the push-to-talk switch, at least on the UV82. The radio needs a little time to come out of transmit mode before it is ready to talk with CHIRP. diff -r cc28502a220f -r 774834381fea chirp/drivers/uv5r.py --- a/chirp/drivers/uv5r.py Sun Oct 16 16:55:56 2016 -0700 +++ b/chirp/drivers/uv5r.py Wed Oct 26 21:40:20 2016 -0700 @@ -398,6 +398,16 @@ def _do_ident(radio, magic): serial = radio.pipe serial.timeout = 1 + # Newer pl2303 drivers in Ubuntu are defaulting DTR to low, but that makes + # the radio transmit instead of talking to the computer. We need DTR to be + # high. See + LOG.info("Set DTR") + # This is redundant since currently pyserial defaults DTR to true, and no + # other code changes it. + serial.dtr = True + # This is the actual fix: the radio needs a chance to respond to DTR coming + # high when the port opens. + time.sleep(1) LOG.info("Sending Magic: %s" % util.hexprint(magic)) for byte in magic: