]> sigrok.org Git - libsigrok.git/commit - src/hardware/fx2lafw/api.c
sr: fx2lafw: Fix a firmware upload bug on 32bit systems.
authorUwe Hermann <redacted>
Wed, 30 May 2012 07:10:41 +0000 (09:10 +0200)
committerUwe Hermann <redacted>
Wed, 30 May 2012 07:30:18 +0000 (09:30 +0200)
commite8bd58ffd2615ab2fbb0a963f359a705c584e4e1
tree4063095d60362ea507d00e9f9e862eb485678612
parent36423d04e5411d9cd744bc6421f099b5d2c02730
sr: fx2lafw: Fix a firmware upload bug on 32bit systems.

The glib GTimeVal data type (and some functions using it) will be faded
out from glib sooner or later, so it's not a good idea to use them anyway.

In this specific case GTimeVal.tv_sec was overflowing, leading a check in
libsigrok to fail, and thus to FX2 firmware upload errors, i.e.
non-working fx2lafw devices.

  http://thread.gmane.org/gmane.comp.debugging.sigrok.devel/166

The root cause is that GTimeVal.tv_sec is a 'glong' (8 bytes on 64bit
systems, but only 4 on 32bit systems).

We now use an int64_t (and g_get_monotonic_time() instead of the more
problematics g_get_current_time() which uses a GTimeVal).

This has been verified to fix the issue on a 32bit system.

Other uses of GTimeVal in libsigrok will be removed in a later release.

Also, drop unneeded GTV_TO_MSEC.
hardware/fx2lafw/fx2lafw.c
hardware/fx2lafw/fx2lafw.h
sigrok-internal.h