keirf / greaseweazle

Tools for accessing a floppy drive at the raw flux level
The Unlicense
984 stars 98 forks source link

Hang on reading track #1

Closed solarmon closed 5 years ago

solarmon commented 5 years ago

Greaseweazle will randomly hang on reading from a PC drive.

Here is the traceback when python is broken out of using CTRL-C:

`

C:\Users\monideth\Downloads\Greaseweazle\Greaseweazle-v0.1>C:\Users\monideth\AppData\Local\Programs\Python\Python37\python gw.py read x-copy.scp COM14

Reading Track 18.0...Traceback (most recent call last): File "gw.py", line 345, in main(sys.argv) File "gw.py", line 339, in main actionsargs.action File "gw.py", line 213, in read flux = read_flux(args.revs) File "gw.py", line 154, in read_flux x += ser.read(1) File "C:\Users\monideth\AppData\Local\Programs\Python\Python37\lib\site-packages\serial\serialwin32.py", line 290, in read True) KeyboardInterrupt

`

Above is for a Python 3.7 64-bit environment, but have also tried in a Python 3.7 32-bit environment, on the same machine which is Windows 10 64-bit.

This is also after increasing the timeout in gw.py:

parser.add_argument("device", timeout="5")

solarmon commented 5 years ago

This issue also occurs on an Amiga floppy drive (with SELECT on pin 10) and a Gotek drive (with SELECT on pin 10).

keirf commented 5 years ago

The correct way to set a timeout is serial.Serial(args.device, timeout=5)

Ie you changed the wrong line.

This is not drive related so switching drives will make no difference.

solarmon commented 5 years ago

Sorry, I wrote that whilst half asleep!

I meant:

ser = serial.Serial(args.device,timeout=5)

And yes, with that I can use CTRL-C to break out of the python script.

drdpj commented 5 years ago

I'm also getting this behaviour :( - Reading Track 14.0...Traceback (most recent call last): File "C:\Users\djame\Downloads\Greaseweazle-v0.1\Greaseweazle-v0.1\gw.py", line 345, in <module> main(sys.argv) File "C:\Users\djame\Downloads\Greaseweazle-v0.1\Greaseweazle-v0.1\gw.py", line 339, in main actions[args.action](args) File "C:\Users\djame\Downloads\Greaseweazle-v0.1\Greaseweazle-v0.1\gw.py", line 213, in read flux = read_flux(args.revs) File "C:\Users\djame\Downloads\Greaseweazle-v0.1\Greaseweazle-v0.1\gw.py", line 154, in read_flux x += ser.read(1) File "C:\Users\djame\AppData\Local\Programs\Python\Python38\lib\site-packages\serial\serialwin32.py", line 286, in read result_ok = win32.GetOverlappedResult( KeyboardInterrupt ^C

also (I think this was unplugging without a ctrl-c) C:\Users\djame\Downloads\Greaseweazle-v0.1\Greaseweazle-v0.1>gw.py read grannyG.scp COM13 Reading Track 58.0...Traceback (most recent call last): File "C:\Users\djame\Downloads\Greaseweazle-v0.1\Greaseweazle-v0.1\gw.py", line 345, in <module> main(sys.argv) File "C:\Users\djame\Downloads\Greaseweazle-v0.1\Greaseweazle-v0.1\gw.py", line 339, in main actions[args.action](args) File "C:\Users\djame\Downloads\Greaseweazle-v0.1\Greaseweazle-v0.1\gw.py", line 213, in read flux = read_flux(args.revs) File "C:\Users\djame\Downloads\Greaseweazle-v0.1\Greaseweazle-v0.1\gw.py", line 155, in read_flux x += ser.read(ser.in_waiting) File "C:\Users\djame\AppData\Local\Programs\Python\Python38\lib\site-packages\serial\serialwin32.py", line 257, in in_waiting raise SerialException("ClearCommError failed ({!r})".format(ctypes.WinError())) serial.serialutil.SerialException: ClearCommError failed (PermissionError(13, 'The device does not recognize the command.', None, 22))

keirf commented 5 years ago

Cheers for the tracebacks!

drdpj commented 5 years ago

I've got an STLINK so if I get the environment set up I should be able to do some proper debugging on the STM side (should it be required)....

(Should also say I've not been able to get a complete read at all, it always hangs at some point... Furthest I've ever got is track 72)

keirf commented 5 years ago

This is fixed in v0.2 to be released later today.