cli: flush output on write
hantek-dso: start sending the frame only from the trigger point

Samples received before the trigger point are stored. From the
trigger point on, every chunk received from the device is sent
up the session bus. After the device has finished sending, the
stored samples are transmitted.
hantek-dso: get rid of broken GTV_TO_MSEC firmware upload timeout
fx2lafw: fix broken firmware upload timeout

Also corner case error init.
hantek-dso: add profiles for all five models in the series

Also cleaned up profile struct, and use the new firmware filenames.
fx2lafw: Made libusb_claim_interface error messages more informative
sr: fx2lafw: Allocate header and packet struct on the stack

The header and packet struct are only used in the scope of this function and
they are freed at the end of it. Also these structs are rather small, so they
can safely be allocated on the stack. By doing so memory leaks on the error
paths are avoided.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
sr: fx2lafw: Properly free transfer

When freeing a transfer we also have to free the transfer buffer. We also have
to keep track of the number of allocated transfers and if the freed transfer was
the last one stop acquisition. This patch introduces a helper function which
takes care of all of this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
sr: fx2lafw: Avoid unnecessary alloc/free combo

In receive_transfer for each completed transfer a new buffer is allocated and
the old one is freed. We can avoid this by simply reusing the buffer for the
next transfer. This is possible if we only resubmit the transfer after all
processing on the data buffer has been done. A new buffer is only allocated if
the size of the old one is not 4096 bytes.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
sr: fx2lafw: Handle the transfer's status

While errors are usually already implicitly caught by looking at the packet
length field there is one error status which is worth special handling. If the
device has been removed there is not really a chance to recover from this error
so data acquisition can be stopped immediately.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
sr: fx2lafw: Calculate buffer size and timeout based on sample rate

Currently timeout and buffer size are hard-coded in the fx2lafw driver which is
non-optimal if we want to get good results at both high and low sample rates.

The timeout is hard-coded to 40ms, which doesn't work well when sampling at
a low sample rate. E.g. at 20kHz filling all available buffer space alone takes
6 seconds. So naturally we'll see a lot of transfers timeout in this case.

The buffer size is hard-coded to 4096 bytes, which does not work well with high
sample rates. E.g. at 24MHz these 4096 bytes are enough space for 0.17ms of
data. The total buffer size is enough for about 5ms of data. Sooner or later the
application won't be able to resubmit a transfer within this time span and the
device will abort data acquisition. Usually this happens within the first few
seconds of sampling.

This patch adds a few new helper functions which calculate the buffer size and
timeout based on the current sample rate.

The buffer size is chosen to be large enough to hold about 10ms of data and it
also must be a multiple of 512 bytes since the firmware will send us the data
in 512 byte chunks.

The timeout is set to the time it would take to fill the whole available buffer
space plus a 25% headroom to accommodate for jitter. This is more than enough,
but there is no need to make the timeout a tight deadline, since it is only
meant as a last resort in case the device stops submitting data. And in this
case data acquisition will be aborted anyway.

The patch also limits the the number of transfers so that the total buffer
space is not much more of 500ms. This will ensure that we do not have to
wait too long when aborting data acquisition.

This patch also significantly reduces the number of context switches when
sampling at a higher sample rate. On my system for example the CPU load of
sigrok-cli when sampling at 24MHz goes down from ~25% to 3-4%.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
sr: fx2lafw: Move empty_transfer_count to device ctx

If one device is failing it should not affect the transfers of other devices.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
srd: Add National LM75 protocol decoder.

This shall support the original National LM75 I2C-based temperature sensor,
as well as various compatible devices of other vendors, such as the
Fairchild FM75, Dallas DS75, and so on.

Currently only 9bit resolution is supported, and not all commands are
decoded, yet. The register contents and temperatures are decoded
correctly though, and can be output in both Celsius and Kelvin.
sr: hantek-dso: Fix copy-paste error.
sr: Mastech VA18B: Partial protocol supports (WIP).

Disable the driver for now, as it's not usable for the general public, yet.
Merge branch 'master' of git://sigrok.git.sourceforge.net/gitroot/sigrok/sigrok
added some untested overdrive functionality, added some comments, modified timing values in annotations
added some TODO comments