Commit Graph

119 Commits

Author SHA1 Message Date
Bert Vermeulen 90165efe55 ols: if no serial port specified, this driver is not used. 2012-11-16 15:26:47 +01:00
Bert Vermeulen 530f201eb8 ols: use new serial API 2012-11-12 02:24:47 +01:00
Bert Vermeulen fe1c50fba6 ols: fix device discovery 2012-11-11 03:12:10 +01:00
Alexandru Gagniuc a99e0d2a0c ols: Do not randomly probe serial ports
ols driver used to probe a series of available serial ports obtained
by regexp matching of common serial port names.
There are a number of problems with this approach:
1. It will probe all serial devices, including devices that do not
like to be probed, potentially causing them to act up.
2. It will try to probe serial ports which may already be opened in
other applications for other purposes.
3. It assumes the naming of the serial ports is set in stone, and
creates an unnecessary OS-specific list.
4. It produces unnecessary debug output even when an OLS device is
not connected.
5. etc...

Do not implicitly probe serial ports. Only probe the port specified
by the frontend, if any; otherwise, just quit.
Also get rid of all functionality in serial.c which was designed
specifically for random probing.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-11-11 03:12:10 +01:00
Bert Vermeulen 69b07d14db allow for intermediate stage in stopping acquisition
In the case of USB drivers, a driver's dev_acquisition_stop() cannot
simply remove its fd sources from the session and close its devices:
a USB transfer might still be underway, and it needs to be finished
(and its memory freed) properly.

An sr_dev_inst->status value is added: SR_ST_STOPPING, which should
be set when the driver's dev_acquisition_stop() is called, and acts
as a marker for the USB event handler to wind up its operations.

In order for dev_acquisition_stop() to be able to set the sdi status,
however, it needs to be unconstified.
2012-11-06 15:16:22 +01:00
Uwe Hermann 886a52b6fb Return SR_ERR_MALLOC upon allocation errors.
Add some TODOs.
2012-10-30 20:25:54 +01:00
Bert Vermeulen 811deee4af sr/drivers: add API calls sr_dev_inst_list() and sr_dev_inst_clear()
These are used to list the device instances currently known to the driver,
and clear that list.

Drivers that don't necessarily clear their list of instances on every scan,
such as genericdmm, need to provide these to the frontend to keep instance
management sane.
2012-08-06 00:59:25 +02:00
Bert Vermeulen 014359e329 sr/drivers: obsolete SR_HWCAP_PROBECONFIG
Since probes now live in a struct sr_dev_inst owned by the driver, it
already knows about them. Instead of a frontend telling the driver to
configure probes, all driver now do this just before starting acquisition.
2012-08-05 18:56:12 +02:00
Bert Vermeulen 26bf9d56c0 ols: remove serial source from session when done 2012-08-03 11:29:01 +02:00
Bert Vermeulen fefc4b858e ols: use driver-private storage for instances 2012-08-03 11:29:00 +02:00
Bert Vermeulen 6f57fd9694 sr: remove obsolete SR_DI_INST 2012-08-03 11:29:00 +02:00
Bert Vermeulen b35c829306 sr/drivers: fix off-by-one if frontend-initiated probe configuration 2012-08-03 11:29:00 +02:00
Bert Vermeulen 9e90dcba9c sr/drivers: remove driver API call dev_status_get()
It's obsolete: no frontend ever used it, and neither did libsigrok.
The sdi->status field is only used internally by some drivers, and
should probably be moved to the driver-specific context structs.
2012-08-03 11:27:31 +02:00
Bert Vermeulen 5d9ed643e9 ols: change driver dev_acquisition_start/_stop calls to use sdi
...yeah, forgot OLS.
2012-08-03 11:27:31 +02:00
Bert Vermeulen 25a0f108f4 sr/drivers: change driver dev_open/dev_close calls to use sdi 2012-08-03 11:27:31 +02:00
Bert Vermeulen 6f4b1868e8 sr/drivers: use sr_dev_inst instead of device index for dev_config_set()
All driver API calls using device index as a parameter will instead use a
const struct sr_dev_inst.
2012-08-03 10:27:39 +02:00
Bert Vermeulen 2ca4465b3d ols: don't use deprecated hwcap_get_all() driver API call 2012-08-03 10:27:39 +02:00
Bert Vermeulen 2efc5948b6 ols: scan fix 2012-08-03 10:27:39 +02:00
Bert Vermeulen dddfb3dbf0 ols: use new driver info_get() API call 2012-08-03 10:27:38 +02:00
Bert Vermeulen 10e5cbede8 ols: use new scan API 2012-08-03 10:27:38 +02:00
Bert Vermeulen e5e81856b4 ols: use driver struct-based device instance list 2012-08-03 10:27:38 +02:00
Bert Vermeulen 61136ea603 sr: add new driver API call: scan()
This changes the semantics of the init() call as well. That now only
initializes the driver -- an administrative affair, no hardware gets
touched during this call. It returns a standard SR_OK or SR_ERR* code.

The scan() call does a discovery run for devices it knows, and returns
the number found. It can be called at any time.
2012-08-03 10:27:36 +02:00
Bert Vermeulen 40dda2c3a5 sr: remove unused argument from hardware driver function init()
It was actually used in one way: the session file loaded abused it for
passing in the filename -- something it definitely wasn't intended for.
This now uses the proper way to pass arguments to a driver: the new
SR_HWCAP_SESSIONFILE.

The OLS driver could also use it as an indication of the serial port to
use instead of actively probing all serial ports on the system, but there
wasn't any frontend code that passed in such a parameter, making it
entirely useless. That will soon be handled differently with the new
scan() API call, regardless.
2012-08-03 10:27:36 +02:00
Bert Vermeulen 45c59c8bdd sr: moved sigrok.h so libsigrok/libsigrok.h
All frontends will have to include <libsigrok/libsigrok.h> from now on.
This header includes proto.h and version.h, both installed from the
distribution into $INCLUDE/libsigrok/ as well.

The only dynamically changed header is now version.h, which has both
libsigrok and libtool compile-time versions in it.
2012-07-05 01:17:28 +02:00
Bert Vermeulen f8c1fcda46 sr: use proper definitions for parity setting
ols driver fixed to use these as well.
2012-07-01 22:31:31 +02:00
Uwe Hermann 9edfee3ee3 sr: ols: Fix incorrect comment. 2012-06-21 23:59:27 +02:00
Joel Holdsworth a533743dd1 sr: Made sample rate lists const 2012-05-31 19:51:11 +01:00
Joel Holdsworth 1b79df2f57 sr: Made the dev_config_set parameter a const pointer 2012-05-31 19:51:11 +01:00
Joel Holdsworth b7f578bef5 sr: Made the dev_info_get return value const 2012-05-31 19:51:10 +01:00
Joel Holdsworth 915f7cc87a sr: Made hwcap const 2012-05-31 19:51:09 +01:00
Bert Vermeulen f366e86c68 sr: change all drivers to use SR_DF_META_LOGIC 2012-05-30 23:55:36 +02:00
Matt Ranostay 13d0d2698c ols: fixed *ctx null dereferences that would SEGFAULT on probing for a OLS or attempting to read from it.
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
2012-03-08 22:27:33 -08:00
Uwe Hermann 0abee5076f sr: Fix some TODOs, improve comments/docs. 2012-03-04 15:10:12 +01:00
Uwe Hermann 3cd3a20b35 sr: More callback param renames.
Start/stop acquisition callbacks: Consistently name the 'void *' parameter
cb_data for now. The per-device-instance device pointer is called
'session_dev_id' everywhere for now, but this should be renamed to
something more clear.
2012-03-04 15:10:09 +01:00
Uwe Hermann 1f9813eb6c sr: Name all callback data 'cb_data'. 2012-03-02 02:25:42 +01:00
Uwe Hermann 31ccebc492 sr: s/sr_session_bus/sr_session_send/. 2012-03-01 23:49:25 +01:00
Uwe Hermann c09f0b578c sr/cli/gtk/qt/: s/plugin/driver/. 2012-02-28 23:52:30 +01:00
Uwe Hermann d261dbbfcc sr: Fix/document probe names. 2012-02-28 01:09:29 +01:00
Uwe Hermann ea9cfed7a5 sr: Consistent ctx name for per-dev-inst context. 2012-02-18 18:07:42 +01:00
Uwe Hermann ee61b340da sr: Remove unneeded temp. variable use. 2012-02-18 12:16:49 +01:00
Uwe Hermann a9a245b428 sr: s/config_set/dev_config_set/.
This functions is per-device-instance, so use dev_ as prefix as with
the other ones.
2012-02-18 12:11:15 +01:00
Uwe Hermann 69040b7c8f sr: s/acquisition_*/dev_acquisition_*/.
These functions are per-device-instance, so use dev_ as prefix as with
the other ones.
2012-02-18 12:03:49 +01:00
Uwe Hermann e7eb703fff sr: opendev/closedev -> dev_open/dev_close. 2012-02-18 11:57:43 +01:00
Uwe Hermann 8105505d06 sr: s/st*_acquisition/acquisition_st*/. 2012-02-18 11:46:51 +01:00
Uwe Hermann 5097b0d091 sr/cli/gtk/qt: s/get_dev_info/dev_info_get/. 2012-02-18 11:41:21 +01:00
Uwe Hermann a7d05fcb38 sr/cli/gtk/qt: s/configuration/config/. 2012-02-18 00:31:35 +01:00
Uwe Hermann ffedd0bf5d sr/cli/gtk: s/capability/hwcap/. 2012-02-18 00:17:18 +01:00
Uwe Hermann 1d9a8a5fe1 sr/cli/gtk: A few more s/instance/inst/. 2012-02-17 23:55:27 +01:00
Uwe Hermann bb7ef79377 sr/cli/gtk/qt: s/device/dev/ in many places.
Also, a few s/instance/inst/ occurences.
2012-02-17 23:47:00 +01:00
Uwe Hermann d68e2d1a21 sr: Some more s/device_instance/dev_inst/. 2012-02-17 22:40:51 +01:00