linux_huawei_unlocker icon indicating copy to clipboard operation
linux_huawei_unlocker copied to clipboard

Specify the port

Open dvdbng opened this issue 7 years ago • 2 comments

In my K3765, unlocking was unsuccessfully at first, because it was trying all ports and one was raising an exception when reading ([Errno 32] Broken pipe). After specifying the port number here It worked. It would be good to be able to specify the device/port manually, but I'm mostly writing this so somebody that has the same problem can find it in google.

dvdbng avatar Jan 07 '18 12:01 dvdbng

Thanks @dvdbng for posting this hint!

#15 (solved in #16) and #17 are duplicates of this issue. The error message when running the script is

Testing port /dev/ttyUSB2

An error occurred when probing for active ports.
This may be because you need to run this program as root.

going back to

>>> serial.Serial(port='/dev/ttyUSB2', timeout=15)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 236, in __init__
    self.open()
  File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 286, in open
    self._update_dtr_state()
  File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 612, in _update_dtr_state
    fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
IOError: [Errno 32] Broken pipe

As pointed out in #16 the solution is to catch the exception. @mcphail I know you don't have access to hardware so happy to test!

chlorenz avatar Feb 10 '18 15:02 chlorenz

Fix suggestion: https://github.com/SHOTbyGUN/linux_huawei_unlocker/commit/ac1bc9c68dda8181b38c3f723689c4d0be24c438

  • to handle the exceptions inside the loop, instead of quitting

I still don't know if ser.close() could raise another exception. I'll try to test my edits in few weeks time.

P.S. I had same issue, manual editing the script I was able to workaround and successfully unlock E1552. But now I don't dare to test my new edits, since I don't want to risk bricking my modem just yet.

But if someone is willing to test my edits in the mean time, you can find it here: https://github.com/SHOTbyGUN/linux_huawei_unlocker/blob/ac1bc9c68dda8181b38c3f723689c4d0be24c438/unlocker.py

SHOTbyGUN avatar Oct 10 '18 04:10 SHOTbyGUN