Commit Graph

83 Commits

Author SHA1 Message Date
Uwe Hermann a0ecd83bc6 Make more variables/functions static and non-global.
The 'GSList *devices' from device.c was actually really global (i.e.,
listed in sigrok.h), which is now fixed.
2011-12-28 22:55:21 +01:00
Uwe Hermann c5d660ae24 Drop unused 'global' struct/variable.
The libs shouldn't have any (externally visible) globals anyway.
2011-12-28 21:38:56 +01:00
Uwe Hermann 08d4cc1d14 device: Make some parameters const. 2011-12-28 21:34:37 +01:00
Uwe Hermann 0e3b143994 device: Change some functions to return int.
The callers of these functions are yet to be changed so that they
actually check the return values and handle errors appropriately.
2011-12-28 17:26:19 +01:00
Uwe Hermann 94799bc4dc device: Add Doxygen comments, improve error handling.
- Add Doxygen comments for all functions (some TODOs remain).

 - Check return code of more functions, handle invalid input.
2011-12-28 16:55:24 +01:00
Bert Vermeulen 8722c31e26 better cleanup of device/plugin resources 2011-06-05 01:51:49 +02:00
Uwe Hermann 697785d1ae libsigrok: closedev() now has a return code.
This is useful to allow frontends to react upon close failures in a
way they see fit (e.g. a popup in the GUI, or error message in the CLI).
They can also still ignore the error if they want, of course.
2011-05-05 13:06:14 +02:00
Uwe Hermann 86f5e3d826 libsigrok: Rename open/close to opendev/closedev. 2011-05-05 13:06:11 +02:00
Uwe Hermann f38bdf5678 Change left-over SIGROK_* to SR_*. 2011-04-26 23:57:16 +02:00
Uwe Hermann b53738baf7 Replace g_malloc{0,} with g_try_malloc{0,}.
The g_malloc()/g_malloc0() versions exit/segfault if not enough memory
is available, which is not a good thing in libsigrok.

Instead, we use the g_try_malloc()/g_try_malloc0() variants, which
return NULL if not enough memory is available, so that the caller can
handle the error properly.
2011-04-16 18:08:15 +02:00
Uwe Hermann b08024a836 libsigrok: Introduce sr_dbg/sr_info/sr_warn/sr_err.
We should use these (internal) functions in libsigrok exclusively from
now on, i.e. no more use of glib's g_debug() etc.

These functions are only for libsigrok, the frontends use whatever
logging mechanism is suitable there.
2011-04-14 10:11:08 +02:00
Bert Vermeulen f437ea3fe2 small warning fix 2011-04-03 06:18:05 +02:00
Uwe Hermann 8225e92175 Constify a few more 'char *' parameters. 2011-02-20 21:16:23 +01:00
Uwe Hermann ee4b6342af Add sr_ prefix to list_hwplugins(). 2011-02-20 21:16:22 +01:00
Uwe Hermann 218557b85a Quickfix for a segfault with file input via -i.
Stuff like

  ./bin/sigrok-cli -i rnd.dd -a transitioncounter

would segfault (rnd.dd consists of random bytes) because device->plugin
was NULL and was being dereferenced.

Thanks Olivier Fauchon <olivier@aixmarseille.com> for reporting.
2011-02-13 11:27:52 +01:00
Uwe Hermann 03dbc020cd Rename probe_find() to sr_device_probe_find(). 2011-02-08 22:28:03 +01:00
Uwe Hermann 2bf4aca64a Add sr_ prefix for device related API functions. 2011-02-08 22:28:02 +01:00
Uwe Hermann 1afe89897c Add sr_ prefix for 'struct probe'. 2011-02-08 22:27:58 +01:00
Bert Vermeulen b8c2f85f56 session_driver: remove unneeded callbacks 2011-02-01 00:06:32 +01:00
Bert Vermeulen dd56a9320d fix device probe adding 2011-01-31 23:44:18 +01:00
Bert Vermeulen 7d65887435 implement session loading based on a virtual device driver 2011-01-31 22:34:14 +01:00
Uwe Hermann 5a2326a71b SR_ prefix for all public enums. 2011-01-30 18:32:59 +01:00
Uwe Hermann 5c2d46d1db Prefix device structs with sr_. 2011-01-30 18:32:58 +01:00
Uwe Hermann a00ba01228 Change all sigrok_ prefixes to sr_. 2011-01-30 18:32:55 +01:00
Bert Vermeulen e54bcdc5d1 cli: don't initialize and scan for hardware unless needed
If the -d <plugin> option is used, only initialize the specified plugin.
2011-01-24 02:49:14 +01:00
Bert Vermeulen 6ea7e23526 Revert "re-enable filter and datastore for DF_LOGIC"
This reverts commit 23da86dfc0a89c7ab951fea31a318a493830eb69.
2011-01-22 14:18:31 +01:00
Daniel Ribeiro 62eeeb171b re-enable filter and datastore for DF_LOGIC
This definitely isn't the proper fix, but it should allow DF_LOGIC
and DF_ANALOG to coexist.
2011-01-21 18:04:09 -02:00
Uwe Hermann 5e2ddeb098 Fix two more compiler warnings noticed on amd64. 2011-01-08 03:51:31 +01:00
Uwe Hermann 757b8c628a Cosmetics, whitespace, simplifications.
Reduce code nesting a bit, constify some strings.
2011-01-08 01:49:47 +01:00
Bert Vermeulen 873080cc03 allow devices without a plugin
this is needed to support file loading: we want a device struct
so we can enumerate probes from the file, but there is no plugin
since the data come in from a device.
2010-05-07 23:52:47 +02:00
Uwe Hermann 1b452b8510 libsigrok: Coding style fixes. 2010-04-15 20:07:16 +02:00
Uwe Hermann afc8e4deb6 Fix all warnings and re-enable -Wextra. 2010-04-09 22:18:46 +02:00
Uwe Hermann a1bb33afbd Start of code base layout restructuring. 2010-04-02 20:27:54 +02:00