Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port can't be opened on Ubuntu 12.04 #18

Open
geekruneat opened this issue Aug 9, 2012 · 14 comments
Open

Port can't be opened on Ubuntu 12.04 #18

geekruneat opened this issue Aug 9, 2012 · 14 comments

Comments

@geekruneat
Copy link

I am using Ubuntu 12.04. I have used the PPA to successfully install the schwinn810 software and I have run the command to configure it (that all works). However, when I run the following command:

sudo ./download.py -port /dev/schwinn810 -dir /home/mike/GPSData >/home/mike/GPSData/schwinn810.log 2>&1

I get the following error:

CRITICAL:main:Port can't be opened :(
schwinn810 Copyright (C) 2012 Mikhail Titov

How do I configure the usb to be recognized as a port?

Mike Chrisman

@mlt
Copy link
Owner

mlt commented Aug 9, 2012

sudo ./download.py -port /dev/schwinn810 -dir /home/mike/GPSData >/home/mike/GPSData/schwinn810.log 2>&1

There is no need to run it with sudo. Also you may try to simply run schwinn810 from /usr/bin/ once all works fine.

Does /dev/schwinn810 exist? Check udev rule in /lib/udev/rules.d/40-schwinn810 (wrote by memory... may differ). If it is there, try sudo service udev restart (wrote by memory). Though it should have been done upon package installation.

The only purpose of udev rule is to map USB-UART converter to /dev/schwinn810 no matter if it appears as /dev/ttyUSB0 or something else.

Remember to connect watch to the cord first, and then insert it into USB port.

How do I configure the usb to be recognized as a port?

You do not. Thanks to cp210x kernel module, watch is accessible as a serial device on /dev/ttyUSB0 or something else if you have many usb serial devices.

@geekruneat
Copy link
Author

Although the /lib/udev/rules.d/40-schwinn810 does exist and looks correct, there is no /dev/schwinn810. Does it need to exist?

Also, if I try to run the command (download.py or schwinn810) without the sudo, I get a permission denied error.

Mike

@mlt
Copy link
Owner

mlt commented Aug 9, 2012

there is no /dev/schwinn810. Does it need to exist?

It should appear once you plug the cable from your watch (even without watch connected). Try to connect just a cable without watch and see if it appears. Also note if /dev/ttyUSB0 appears or not. dmesg might be helpful.

without the sudo, I get a permission denied error

If you are not using udev rule and /dev/schwinn810 but just /dev/ttyUSB0 then you have to be a member of dialout group. However that udev rule is also supposed to change permission so anyone can access /dev/ttyUSB0 (or alike) or a symlink /dev/schwinn810 to it.

I'd recommend first to make sure that USB-serial converter in the cable from watch is properly recognized, and udev rule is working.

@geekruneat
Copy link
Author

OK, if I use /dev/ttyUSB0 instead of /dev/schwinn810, I get past that error but now I get the following error:

schwinn810 Copyright (C) 2012 Mikhail Titov

This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under the terms of GPL-3 or later version.

/usr/bin/gpsbabel
Traceback (most recent call last):
File "/usr/share/schwinn810/download.py", line 75, in
main()
File "/usr/share/schwinn810/download.py", line 63, in main
d.read(w, p)
File "/usr/share/schwinn810/core/device.py", line 134, in read
wpt = self.reader.read_waypoint()
File "/usr/share/schwinn810/core/reader_schwinn.py", line 95, in read_waypoint
wpt['Time'] = datetime(2000+yy, mm, dd, hh, mn, ss)
ValueError: month must be in 1..12

Mike Chrisman

@geekruneat
Copy link
Author

Unplugging and plugging in the cable does cause the /dev/ttyUSB0 to disappear/appear, however, /dev/schwinn810 never appears. For testing purposes right now I use using the sudo, so permissions are not an issue (I will work out the permissions issue once I can get it to sync). The rule is in the correct folder and should be working.

Here is my output from dmesg:

[   10.964284] usbcore: registered new interface driver usbserial
[   10.964302] USB Serial support registered for generic
[   10.964339] usbcore: registered new interface driver usbserial_generic
[   10.964341] usbserial: USB Serial Driver core
[   10.979159] USB Serial support registered for cp210x
[   10.979203] cp210x 8-2:1.0: cp210x converter detected
[   10.980672] logitech-djreceiver 0003:046D:C52B.0004: hiddev0,hidraw1: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:1a.0-2/input2
[   10.985664] input: Logitech Unifying Device. Wireless PID:4004 as /devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2:1.2/0003:046D:C52B.0004/input/input5
[   10.985769] logitech-djdevice 0003:046D:C52B.0005: input,hidraw2: USB HID v1.11 Keyboard [Logitech Unifying Device. Wireless PID:4004] on usb-0000:00:1a.0-2:1
[   11.088038] usb 8-2: reset full-speed USB device number 2 using uhci_hcd
[   11.239278] usb 8-2: cp210x converter now attached to ttyUSB0
[   11.239300] usbcore: registered new interface driver cp210x
[   11.239303] cp210x: v0.09:Silicon Labs CP210x RS232 serial adaptor driver
[   11.358101] kjournald starting.  Commit interval 5 seconds
[   11.358377] EXT3-fs (sda2): warning: maximal mount count reached, running e2fsck is recommended
[   11.358739] EXT3-fs (sda2): using internal journal
[   11.358746] EXT3-fs (sda2): mounted filesystem with ordered data mode
[   12.141263] snd_hda_intel 0000:00:1b.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[   12.141326] snd_hda_intel 0000:00:1b.0: irq 43 for MSI/MSI-X
[   12.141356] snd_hda_intel 0000:00:1b.0: setting latency timer to 64
[   12.289885] nvidia: module license 'NVIDIA' taints kernel.
[   12.289889] Disabling lock debugging due to kernel taint
[   12.673909] NVRM: The NVIDIA GeForce4 MX 4000 GPU installed in this system is
[   12.673911] NVRM:  supported through the NVIDIA 96.43.xx Legacy drivers. Please
[   12.673912] NVRM:  visit http://www.nvidia.com/object/unix.html for more
[   12.673914] NVRM:  information.  The 295.40 NVIDIA driver will ignore
[   12.673915] NVRM:  this GPU.  Continuing probe...
[   12.673924] NVRM: No NVIDIA graphics adapter found!
[   13.747541] type=1400 audit(1344541761.078:2): apparmor="STATUS" operation="profile_load" name="/sbin/dhclient" pid=615 comm="apparmor_parser"
[   13.747553] type=1400 audit(1344541761.078:3): apparmor="STATUS" operation="profile_replace" name="/sbin/dhclient" pid=658 comm="apparmor_parser"
[   13.748038] type=1400 audit(1344541761.082:4): apparmor="STATUS" operation="profile_load" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=615 comm="apparmor_parser"
[   13.748050] type=1400 audit(1344541761.082:5): apparmor="STATUS" operation="profile_replace" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=658 comm="apparmor_parser"
[   13.748310] type=1400 audit(1344541761.082:6): apparmor="STATUS" operation="profile_load" name="/usr/lib/connman/scripts/dhclient-script" pid=615 comm="apparmor_parser"
[   13.748324] type=1400 audit(1344541761.082:7): apparmor="STATUS" operation="profile_replace" name="/usr/lib/connman/scripts/dhclient-script" pid=658 comm="apparmor_parser"
[   15.520076] init: failsafe main process (862) killed by TERM signal
[   19.051227] Bluetooth: Core ver 2.16
[   19.051252] NET: Registered protocol family 31
[   19.051254] Bluetooth: HCI device and connection manager initialized
[   19.051258] Bluetooth: HCI socket layer initialized
[   19.051260] Bluetooth: L2CAP socket layer initialized
[   19.051267] Bluetooth: SCO socket layer initialized
[   19.239907] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   19.239911] Bluetooth: BNEP filters: protocol multicast
[   19.308379] type=1400 audit(1344541766.642:8): apparmor="STATUS" operation="profile_load" name="/usr/lib/cups/backend/cups-pdf" pid=948 comm="apparmor_parser"
[   19.308951] type=1400 audit(1344541766.642:9): apparmor="STATUS" operation="profile_load" name="/usr/sbin/cupsd" pid=948 comm="apparmor_parser"
[   19.338857] Bluetooth: RFCOMM TTY layer initialized
[   19.338863] Bluetooth: RFCOMM socket layer initialized
[   19.338865] Bluetooth: RFCOMM ver 1.11
[   21.014103] e1000e 0000:00:19.0: irq 40 for MSI/MSI-X
[   21.041110] type=1400 audit(1344541768.374:10): apparmor="STATUS" operation="profile_replace" name="/sbin/dhclient" pid=1000 comm="apparmor_parser"
[   21.041609] type=1400 audit(1344541768.374:11): apparmor="STATUS" operation="profile_replace" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=1000 comm="apparmor_parser"
[   21.041883] type=1400 audit(1344541768.374:12): apparmor="STATUS" operation="profile_replace" name="/usr/lib/connman/scripts/dhclient-script" pid=1000 comm="apparmor_parser"
[   21.068101] e1000e 0000:00:19.0: irq 40 for MSI/MSI-X
[   21.068375] ADDRCONF(NETDEV_UP): eth0: link is not ready
[   21.068736] ADDRCONF(NETDEV_UP): eth0: link is not ready
[   21.196026] type=1400 audit(1344541768.530:13): apparmor="STATUS" operation="profile_load" name="/usr/lib/lightdm/lightdm/lightdm-guest-session-wrapper" pid=999 comm="apparmor_parser"
[   21.314313] type=1400 audit(1344541768.646:14): apparmor="STATUS" operation="profile_load" name="/usr/lib/telepathy/mission-control-5" pid=1006 comm="apparmor_parser"
[   21.314875] type=1400 audit(1344541768.646:15): apparmor="STATUS" operation="profile_load" name="/usr/lib/telepathy/telepathy-*" pid=1006 comm="apparmor_parser"
[   21.319508] type=1400 audit(1344541768.650:16): apparmor="STATUS" operation="profile_replace" name="/usr/lib/cups/backend/cups-pdf" pid=1008 comm="apparmor_parser"
[   21.320121] type=1400 audit(1344541768.654:17): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/cupsd" pid=1008 comm="apparmor_parser"
[   22.448875] e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: Rx/Tx
[   22.448881] e1000e 0000:00:19.0: eth0: 10/100 speed: disabling TSO
[   22.449070] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   24.861480] vboxdrv: Found 2 processor cores.
[   24.861608] vboxdrv: fAsync=0 offMin=0x1fe offMax=0x780
[   24.861672] vboxdrv: TSC mode is 'synchronous', kernel timer mode is 'normal'.
[   24.861674] vboxdrv: Successfully loaded version 4.1.12_Ubuntu (interface 0x00190000).
[   25.296023] vboxpci: IOMMU not found (not registered)
[   32.087578] init: plymouth-stop pre-start process (1459) terminated with status 1
[   33.792037] eth0: no IPv6 routers present
[ 3084.048061] usb 8-2: USB disconnect, device number 2
[ 3084.048309] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[ 3084.048339] cp210x 8-2:1.0: device disconnected
[ 3091.488039] usb 8-2: new full-speed USB device number 3 using uhci_hcd
[ 3091.662136] cp210x 8-2:1.0: cp210x converter detected
[ 3091.772025] usb 8-2: reset full-speed USB device number 3 using uhci_hcd
[ 3091.923191] usb 8-2: cp210x converter now attached to ttyUSB0
[ 3277.364505] udevd[3613]: starting version 175
[ 6867.288078] usb 8-2: USB disconnect, device number 3
[ 6867.288345] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[ 6867.288373] cp210x 8-2:1.0: device disconnected
[ 6900.192047] usb 8-2: new full-speed USB device number 4 using uhci_hcd
[ 6900.370163] cp210x 8-2:1.0: cp210x converter detected
[ 6900.536030] usb 8-2: reset full-speed USB device number 4 using uhci_hcd
[ 6900.683252] usb 8-2: cp210x converter now attached to ttyUSB0

Mike

@mlt
Copy link
Owner

mlt commented Aug 9, 2012

File "/usr/share/schwinn810/core/reader_schwinn.py", line 95, in read_waypoint
wpt['Time'] = datetime(2000+yy, mm, dd, hh, mn, ss)
ValueError: month must be in 1..12

oops... I guess I didn't not test waypoints stuff after code re-organization :-) I'll investigate that.

Meanwhile, you can adjust read_waypoint function by adding return right after reading from port. I'm talking about /usr/share/schwinn810/core/reader_schwinn.py.

I wonder what are you getting in there... Just a reminder that one should attempt to extract data only when clock shows either connection screen or charging screen and NOT data transmission one.

Unplugging and plugging in the cable does cause the /dev/ttyUSB0 to disappear/appear, however, /dev/schwinn810 never appears.

Did you restart udev service?

P.S. There was no need in the whole history for dmesg. I cut it.

@mlt
Copy link
Owner

mlt commented Aug 9, 2012

Also if you've installed the package make sure that schwinn810-tray.py is not running.

@geekruneat
Copy link
Author

We are making headway. I can now get the command to extract the data off the watch and generate the .points/.laps/.tracks files. However, once the data has been extracted, I get the following error:

schwinn810  Copyright (C) 2012 Mikhail Titov

This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under the terms of GPL-3 or later version.

/usr/bin/gpsbabel
/usr/bin/gpsbabel
Traceback (most recent call last):
  File "/usr/share/schwinn810/download.py", line 75, in <module>
    main()
  File "/usr/share/schwinn810/download.py", line 63, in main
    d.read(w, p)
  File "/usr/share/schwinn810/core/device.py", line 135, in read
    writer.add_waypoint(wpt)
  File "/usr/share/schwinn810/core/writer_csv.py", line 86, in add_waypoint
    self.wptWriter.writerow(wp)
  File "/usr/lib/python2.7/csv.py", line 148, in writerow
    return self.writer.writerow(self._dict_to_list(rowdict))
  File "/usr/lib/python2.7/csv.py", line 141, in _dict_to_list
    wrong_fields = [k for k in rowdict if k not in self.fieldnames]
TypeError: 'NoneType' object is not iterable

The odd thing is if I then execute babelize.sh (passing in the name of the track to convert) it generates the .gpx and .tcx files without error.

@mlt
Copy link
Owner

mlt commented Aug 10, 2012

We are making headway

Great! What was the problem?

self.wptWriter.writerow(wp)

oops... I guess I didn't not test waypoints stuff after code re-organization :-) I'll investigate that.

I confirm my words that waypoint extraction is broken in > 0.1.1 version. I'll commit working version this evening. For now, you can comment out the fragment that writes waypoints to file perhaps by inserting return as I suggested before.

if I then execute babelize.sh (passing in the name of the track to convert) it generates the .gpx and .tcx files without error

This is expected. Waypoints (created when you click/hold EL(?)/light button) are not used in generation of those files.

@geekruneat
Copy link
Author

Not only did I have add the return as you stated above, but I also had to comment out line 133-135 in device.py. However, it now works (without the sudo command). The /dev/schwinn810 device port never did show up, but I am happy using /dev/ttyUSB0 (as long as it works).

Thanks for writing this great tool. I have the Red Clover watch and the software that come with is less than desirable (and the .tcx export does not export the heart rate data). Plus not having to run a VM of windows just to sync the watch is a big bonus. Keep up the great work.

@mlt
Copy link
Owner

mlt commented Aug 10, 2012

also had to comment out line 133-135 in device.py

I would comment only line 135. I think it still should read that data as watch unconditionally sends it anyway. As I said I'll fix it.

The /dev/schwinn810 device port never did show up ... I have the Red Clover watch

If it did not show up even after restart of udev provided the rule is there, then it is possible that different USB vendor/product ID is being used. Could you check using lsusb or something if vendor and product are 10c4 and ea61 respectively?

This is somewhat important as I bet schwinn810-tray.py also does not extract data as it expects those IDs.

Also would you mind sharing SET->PROD.ID as returned by watch and probably /tmp/schwinn810.bin as created by download.py with --debug option preferably with no tracks or short ones? This would help me to better discern between different brands.

Keep up the great work

Thanks! I will try:-)

@geekruneat
Copy link
Author

lsusb:

Bus 008 Device 002: ID 10c4:ea61 Cygnal Integrated Products, Inc. 

Looks like the vendor/product ID are the same.

When I try to execute the download.py command without any data on the watch, it throws the following error:

Traceback (most recent call last):
  File "/usr/share/schwinn810/download.py", line 75, in <module>
    main()
  File "/usr/share/schwinn810/download.py", line 64, in main
    d.close()
  File "/usr/share/schwinn810/core/device.py", line 145, in close
    self.backup.close()
AttributeError: 'NoneType' object has no attribute 'close'

When I have a short run, I will send you the debug dump.

My PROD.ID is: E111014 000016 1105143 01-067

Mike Chrisman

@mlt
Copy link
Owner

mlt commented Aug 10, 2012

Looks like the vendor/product ID are the same

Check udev rule content. It should begin with SUBSYSTEMS=="usb", SUBSYSTEM=="tty" and not BUS=

When I try to execute the download.py command without any data on the watch, it throws the following error

Wow... good to know. I'll fix it.

@mlt mlt reopened this Aug 10, 2012
@geekruneat
Copy link
Author

This is what I have in the udev rule:

SUBSYSTEMS=="usb", SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea61", SYMLINK+="schwinn810", MODE="0666"

The file is called: /etc/udev/rules.d/40-schwinn810.rules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants