fgebhart / workoutizer

:weight_lifting: Browser based Sport and Workout Organizer :running_woman:
MIT License
62 stars 11 forks source link

[BUG] Incorrect if statement causes block devices to never be mounted #183

Closed gotiniens closed 3 years ago

gotiniens commented 3 years ago

Describe the bug A bit embarrassing but an incorrect if statement in the fit_collector._find_device_type function causes Block devices to never be mounted

To Reproduce Steps to reproduce the behavior:

  1. Run latest version
  2. connect block device
  3. see error:
    07-10 11:03:59 - DEBUG - wkz.file_helper.fit_collector - trying to mount device...
    07-10 11:03:59 - DEBUG - wkz.file_helper.fit_collector - found Garmin device in: Bus 001 Device 003: ID 091e:26e5 Garmin International 
    07-10 11:03:59 - DEBUG - wkz.file_helper.fit_collector - Looking up type of device
    07-10 11:03:59 - DEBUG - wkz.file_helper.fit_collector - Device is block device
    07-10 11:03:59 - ERROR - wkz.api - could not mount device: cannot unpack non-iterable NoneType object
    Traceback (most recent call last):
    File "/home/pi/venv/lib/python3.7/site-packages/wkz/api.py", line 18, in mount_device_endpoint
    mount_path = try_to_mount_device()
    File "/home/pi/venv/lib/python3.7/site-packages/wkz/file_helper/fit_collector.py", line 93, in try_to_mount_device
    (type, path) = _find_device_type(bus, dev)
    TypeError: cannot unpack non-iterable NoneType object
    07-10 11:03:59 - ERROR - django.request - Internal Server Error: /mount-device/
    07-10 11:03:59 - ERROR - django.channels.server - HTTP POST /mount-device/ 500 [0.26, 192.168.2.182:52808]