Commit Graph

22 Commits

Author SHA1 Message Date
Jon Escombe
92b998f746 Detach kernel driver before claiming USB2 ANT+ interface.
Only detach kernel driver if compiling under Linux (not a portable function)..
2013-09-22 00:56:24 +01:00
Jon Escombe
9fb2964223 Detach kernel driver before claiming USB2 ANT+ interface.
Kernel 3.11 exposes the Suunto ANT+ stick as a USB serial device,
this prevents GC from opening it in training mode unless the
kernel driver is detached first.
2013-09-21 22:44:30 +01:00
Mark Liversedge
05f1d577db Refactor MainWindow Part 2 of 5
Decoupled classes from MainWindow to reference Context
and Athlete (and introduced a couple of new headers).

We no longer pass around a MainWindow pointer to children
but pass a context instead.

There are still a few pieces left in MainWindow that need
to move to a better place;
    * Setting/clearing filter selection
    * Working with Intervals
    * Adding/Deleting Rides
    * Save on Exit

As mentioned previously there are lots of other parts to
this refactor left to do;
    * break MainWindow Gui elements into Toolbar and Views

    * migrate from RideItem and Ridelist to ActivityCollection
      and Activity classes that are not tied into gui elements.

    * introduce Application Context and AthleteCollection
2013-07-11 14:02:02 +01:00
Mark Liversedge
e471df6e08 Add alpha support for Dynastream OEM USB ant+
.. different pid of 1009 to the garmin usb2 stick
   but probably works the same .. lets see!
2013-05-31 20:05:58 +01:00
Jon Escombe
5dad281181 Change usb_bulk_read() timeout back to 125ms 2013-05-04 10:33:09 +01:00
Mark Liversedge
0cb46687ab Code Cleanup: LibUsb
.. removed commented out code.
2013-02-11 14:40:58 +00:00
Mark Liversedge
1f8b49f5cd Fortius 0x1932 added to find logic
Forgot to add update to the find method when
adding experimental support for the 0x1932
revision of the Tacx Fortius.
2012-11-18 16:13:15 +00:00
Mark Liversedge
775ec92cb7 Experiment: Support for Tacx Fortius 0x1932
.. lets see if this actually works.
2012-11-07 20:02:09 +00:00
Mark Liversedge
43b1c61d6b Add Device Wizard
Introduce a wizard for adding realtime devices since it
is prone to user error, is relatively complicated and is
something most users will only ever do once or twice.

There are several logical updates within this patch:

First; Fix intermittent ANT+ not working
* LibUsb     - check bufRemaining is > 0 not non-zero
* LibUsb     - Always reset the USB stick on open
* ANT.cpp    - Support > 4 channels on USB2
* ANTChannel -  Do not use pairing, but always
*               unassign, assign and set channel id.

Second; Fix device discovery
* Find and discover support in realtime controllers
* Extend Serial.cpp to cover more Serial devices
* Support for 4 or 8 ANT channels for USB1/USB2

Third; Introduce Add Device Wizard with
* General and Specific wizard pages for each device type
* Device pairing with telemetry display
* fixed compile time warnings

Fourth; Update Device Config Page
* use wizard to add new device
* remove edit fields, replaced by wizard
* remove pair, firmware buttons replaced by wizard

Fifth; Deprecate/Remove Device Types
* Null Device - used by developers only
* Quarqd client - replaced by Native ANT+
* GC Server - not implemented yet

I have also introduced a device specific wheel size
and flags for controlling the default selection and
sources for sensor data when in multi-device mode. These
are not yet supported in the code.

Fixes #611.
Fixes #497.
2012-01-21 20:28:33 +00:00
Mark Liversedge
07ea957f61 Fix need to 'reset' USB2 stick between sessions
It was neccessary to reset the USB2 stick between
sessions. This was due to incorrect state data
being maintained within the ANT code.

New sessions should start without requiring a USB
device reset or running ANT agent etc.

Fixes #558.
2012-01-06 11:38:20 +00:00
Mark Liversedge
e028faf0ac Remove dynamic load of libusb on Windows
It wasn't adding any value and caused problems
with static build targets and using libusb functions
in other parts of the code (e.g. EzUsb).
2011-12-17 22:21:51 +00:00
Mark Liversedge
ca45ef310e Tacx Fortius fixes for Mac OSX
Under Mac OSX the Tacx Fortius support needed
a few minor tweaks;

* sleep 60ms between read/write operations to
  avoid interrupt errors

* clear_halt on read/write endpoints before
  attempting to read/write to the device

* remove the errant usb_reset which really should
  not have been called in LibUsb since it deletes
  the device structure(!)

The LibUsb class has been modified to clear_halt
when opening ANT devices too -- since regression
testing on Mac showed that a) you need the latest
drivers to work with a USB2 stick on Lion (64bit)
and it now appears to mandate a clear_halt when
opening the device (but this may be related to the
Garmin ANT agent leaving it in an unknown state).
2011-12-17 12:31:25 +00:00
Mark Liversedge
9a58bcee6c Mingw has not sleep(), uses WinAPI Sleep(). 2011-12-12 22:33:45 +00:00
Mark Liversedge
b206b8af50 Mingw build fixups
- #ident not supported in EzUsb.cpp
- sleep() missing <unistd.h> in LibUsb.cpp
2011-12-12 22:24:22 +00:00
Mark Liversedge
67983b81c3 Tacx Fortius Support
Initial support for Tacx Fortius devices.

Note this requires libusb support to be present and will
work on Linux, Mac and Windows.

The handlebar buttons up/down will increase/decrease the
load/intensity in a similar fashion to the +/- keys on
the Computrainer controller.

The cancel button will stop a workout and the enter key
is used to mark a lap.

Slope and Ergo modes are supported, but we do not set the
brake at all if the speed is below 10kph, this is to
ensure it does not get burnt out when users 'grind'.

SPECIAL NOTE:

   The Fortius handlebar controller is a Ez-Usb device
   and requires firmware to be loaded when it is connected.
   Since this is copyrighted by Tacx BV we do not distribute
   it, instead, when the user sets up a Fortius device they
   must also provide the file. Full instructions on how this
   should be done are given when configuring the device.

Additionally, for Linux users udev rules should be added to
ensure that the USB devices are accessible to non-root users.

Fixes #538.
2011-12-12 17:26:59 +00:00
Gareth Coco
6f913f118d Fix Windows LibUsb compile error
declaration of int rc was missing on Windows
since it was removed by the pre-processor.

This patch declares int rc before use.
2011-11-04 16:34:07 +00:00
Mark Liversedge
9691746be2 LibUsb does not have usb_reset on Windows
We call usb_reset between sessions on Linux/Mac
because the USB device is left in an undetermined
state after close. In the comments I noted that
it was odd this was not required on Windows.

Well, it turns out it is not available on Windows.
This patch ensures we do not try to call it when
compiling for Windows.
2011-11-04 08:42:40 +00:00
Mark Liversedge
9f161ea7a2 Support Garmin USB2 ANT+ sticks on Mac OS X
This update completes support for USB2 sticks for ANT+ devices
in train view. The code now works on Linux and Mac as well as
Windows.

IOKit is now a required framework for builds on Mac OSX and
src.pro has been updated accordingly.

I have also added a tarball of the required version of libusb
in a new 'contrib' directory. Users may wish to use a later
version or download from an alternative source, but this
version is guaranteed to work.

Fixes #310
2011-10-26 16:00:33 +01:00
Mark Liversedge
9b079f6c9b Support Garmin USB2 sticks on Linux
Fixup support for USB2 on Linux via libusb. The code
is pretty ghetto with a maze of pre-processor conditionals.
But it works.

Of special note:
* You MUST build with a very specific version of libusb, the
  stock libs in Ubuntu do not work. Might pull the code into
  the main repo, since its pretty darned tiny.

* On Linux access controls for the USB devices is controlled
  by udev, and requires a rule adding to ensure the devie can
  be read/written by users other than root. A udev rule file
  has been added to a 'linux' subdirectory in src.

Some of the timeouts and usb setup/reset code has been adjusted
to ensure the device is always in a consistent state. This appears
to be more important on Linux than Windows for some reason.
2011-10-26 02:29:10 +01:00
Darren Hague
847340e098 Improve stability when libusb0.dll is not present 2011-03-24 07:26:35 +00:00
Darren Hague
7efa27d5b3 Dynamic load of libusb0.dll
This means that libusb0.dll does not have to be included in the
Golden Cheetah distribution - the code will load it automatically
from windows\system32 on demand when realtime mode is invoked in
Native ANT+ mode. Insertion of a USB2 ANT+ stick will cause Windows
to download and install libusb0 automatically.
2011-03-22 07:12:29 +00:00
Darren Hague
f8d60bfbe2 Native ANT+ part 2 - USB2 Support and minor improvements
This patch adds support for the Garmin USB2 stick using
libusb-win library. Instructions are included in gcconfig.pri.in
for configuring and installing the neccessary libs.

To enable support for USB1 and USB2 support in the same binary
stubs are created when UsbXpress/Libusb are not available and the
device i/o attempts to use USB2 before falling back to USB1.

Since I was also in the middle of some coding changes I merged
my developments (Mark) with Darren's patch whilst fixing it up
for commit, namely:

1. the configuration screen no longer demands a COMx port
   when using Native ANT+ on Windows.
2.  new signals in ANTChannel notify the ANT class when info is
   stale or lost (but they are not used at present).
3. The previous debug messages have been removed, although new
   debug messages are added for stale/drop/timeout signals.
2011-03-19 21:03:43 +00:00