You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
(1) |
Apr
(9) |
May
(20) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(8) |
Oct
|
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(25) |
Feb
(1) |
Mar
(14) |
Apr
(12) |
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
(8) |
Nov
(14) |
Dec
(3) |
2012 |
Jan
|
Feb
(13) |
Mar
(17) |
Apr
(32) |
May
(22) |
Jun
(35) |
Jul
(56) |
Aug
(16) |
Sep
(8) |
Oct
(26) |
Nov
(30) |
Dec
(29) |
2013 |
Jan
(23) |
Feb
(19) |
Mar
(9) |
Apr
(39) |
May
(30) |
Jun
(23) |
Jul
(33) |
Aug
(7) |
Sep
(13) |
Oct
(40) |
Nov
(91) |
Dec
(43) |
2014 |
Jan
(59) |
Feb
(37) |
Mar
(28) |
Apr
(43) |
May
(37) |
Jun
(21) |
Jul
(56) |
Aug
(43) |
Sep
(44) |
Oct
(102) |
Nov
(31) |
Dec
(48) |
2015 |
Jan
(111) |
Feb
(114) |
Mar
(36) |
Apr
(59) |
May
(19) |
Jun
(17) |
Jul
(13) |
Aug
(36) |
Sep
(24) |
Oct
(43) |
Nov
(66) |
Dec
(39) |
2016 |
Jan
(41) |
Feb
(33) |
Mar
(21) |
Apr
(54) |
May
(48) |
Jun
(34) |
Jul
(42) |
Aug
(73) |
Sep
(31) |
Oct
(115) |
Nov
(41) |
Dec
(48) |
2017 |
Jan
(31) |
Feb
(32) |
Mar
(23) |
Apr
(20) |
May
(70) |
Jun
(26) |
Jul
(17) |
Aug
(22) |
Sep
(15) |
Oct
(14) |
Nov
(20) |
Dec
(4) |
2018 |
Jan
(45) |
Feb
(27) |
Mar
(16) |
Apr
(54) |
May
(30) |
Jun
(50) |
Jul
(25) |
Aug
(5) |
Sep
(7) |
Oct
(60) |
Nov
(75) |
Dec
(21) |
2019 |
Jan
(18) |
Feb
(14) |
Mar
(17) |
Apr
(15) |
May
(17) |
Jun
(9) |
Jul
(12) |
Aug
(11) |
Sep
(22) |
Oct
(30) |
Nov
(19) |
Dec
(18) |
2020 |
Jan
(29) |
Feb
(12) |
Mar
(54) |
Apr
(51) |
May
(50) |
Jun
(50) |
Jul
(34) |
Aug
(29) |
Sep
(54) |
Oct
(77) |
Nov
(26) |
Dec
(16) |
2021 |
Jan
(71) |
Feb
(22) |
Mar
(63) |
Apr
(15) |
May
(23) |
Jun
(30) |
Jul
(23) |
Aug
(15) |
Sep
(5) |
Oct
(12) |
Nov
(7) |
Dec
(5) |
2022 |
Jan
(44) |
Feb
(33) |
Mar
(16) |
Apr
(5) |
May
(9) |
Jun
(13) |
Jul
(7) |
Aug
(34) |
Sep
(22) |
Oct
(5) |
Nov
(31) |
Dec
(33) |
2023 |
Jan
(15) |
Feb
(3) |
Mar
(9) |
Apr
(20) |
May
(50) |
Jun
(6) |
Jul
(6) |
Aug
(6) |
Sep
(4) |
Oct
(7) |
Nov
(7) |
Dec
(6) |
2024 |
Jan
(8) |
Feb
(10) |
Mar
(7) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ing. G. O. <gab...@na...> - 2024-03-16 09:53:19
|
Thanks a lot for taking the time to reply and give me some pointers. I'll look into your changes and I'll try to build from recent sources as soon as I've some spare time. Thanks again :-) |
From: Jon E. <li...@dr...> - 2024-03-15 15:58:11
|
On 14/03/2024 18:02, Ing. Gabriele Oberhammer wrote: > Hi all, > > I'm facing several problems when trying to use my DreamSourceLab DSLogic > basic with PulseView > Hi, There was an effort a couple of years ago to get the DSLogic support updated, but this was never accepted upstream. If you're able to build from source, then it may be worth trying? fwiw, I didn't have much luck with my DSLogic Plus without these changes.. The updates; https://github.com/christianeisendle/libsigrok/tree/dslogic_u3pro16 The PR; https://github.com/sigrokproject/libsigrok/pull/170 And if it helps to be slightly more recent, I rebased Christian's changes against upstream libsigrok middle of last year; https://github.com/dresco/libsigrok/tree/dslogic Regards, Jon. |
From: Ing. G. O. <gab...@na...> - 2024-03-14 18:19:19
|
Hi all, I'm facing several problems when trying to use my DreamSourceLab DSLogic basic with PulseView, i.e.: - sometimes it does not trigger on the signal - sometimes it triggers and captures the buffer, but the buffer is all '1' - only some combinations of sample rate and buffer size seem to work, e.g. 20MHz and 10Msps seems to work and giving a correct capture, other settings do not trigger and/or gives back an all '1' buffer - sometimes it goes nuts and the capture does not stop and the buffer starts to fill with the same repeated data infinitely and I need to unlplug and replug to have ti working again. (I remember reading of a problem like that on the list but I can't find it now) I'm using latest PulseView appimage (0.5.0-git-9b8b734, libsigrok 0.6.0-git/4:0:0 (rt: 0.6.0-git-b503d24/4:0:0)) I've downloaded and installed the vendor suggested firmware following this script: http://sigrok.org/gitweb/?p=sigrok-util.git;a=blob;f=firmware/dreamsourcelab-dslogic/sigrok-fwextract-dreamsourcelab-dslogic Has anyone encountered similar problems ? Can anyone suggest some solution ? Thanks in advance for any help :-) This is the information output using sigrok appimage: ./sigrok-cli-NIGHTLY-x86_64-debug.appimage --driver=dreamsourcelab-dslogic --show Driver functions: Logic analyzer Scan options: conn dreamsourcelab-dslogic:conn=1.12 - DreamSourceLab DSLogic Basic with 16 channels: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Channel groups: Logic: channels 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Supported configuration options across all channel groups: continuous: on, off (current) limit_samples: 0 (current) voltage_threshold: 0.0-0.0, 0.1-0.1, 0.2-0.2, 0.3-0.3, 0.4-0.4, 0.5-0.5, 0.6-0.6, 0.7-0.7, 0.8-0.8, 0.9-0.9, 1.0-1.0, 1.1-1.1, 1.2-1.2, 1.3-1.3, 1.4-1.4, 1.5-1.5, 1.6-1.6, 1.7-1.7, 1.8-1.8, 1.9-1.9, 2.0-2.0, 2.1-2.1, 2.2-2.2, 2.3-2.3, 2.4-2.4, 2.5-2.5, 2.6-2.6, 2.7-2.7, 2.8-2.8, 2.9-2.9, 3.0-3.0, 3.1-3.1, 3.2-3.2, 3.3-3.3, 3.4-3.4, 3.5-3.5, 3.6-3.6, 3.7-3.7, 3.8-3.8, 3.9-3.9, 4.0-4.0, 4.1-4.1, 4.2-4.2, 4.3-4.3, 4.4-4.4, 4.5-4.5, 4.6-4.6, 4.7-4.7, 4.8-4.8, 4.9-4.9, 5.0-5.0 conn: 1.12 (current) samplerate - supported samplerates: 10 kHz (current) 20 kHz 50 kHz 100 kHz 200 kHz 500 kHz 1 MHz 2 MHz 5 MHz 10 MHz 20 MHz 25 MHz 50 MHz 100 MHz 200 MHz 400 MHz Supported triggers: 0 1 r f e captureratio: 0 (current) external_clock: on, off (current) clock_edge: rising (current), falling |
From: Timur Y. <ti...@ti...> - 2024-03-09 14:15:00
|
Most of the links here don't seem to work at the moment https://sigrok.org/wiki/Downloads e.g. curl https://sigrok.org/download/binary/sigrok-cli/sigrok-cli-NIGHTLY-x86_64.appimage <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL was not found on this server.</p> </body></html> |
From: Vesa-Pekka P. <vp...@de...> - 2024-03-07 07:49:04
|
The failing tests deal with floating point math precision and aren't fatal in of themselves, just something that Someone should dig into when able. Commenting out the pulseview tests should give you usable locally built sigrok stack. On Wed, 6 Mar 2024, Lars Urban via sigrok-devel wrote: > Hi dev team, > > I am trying to build sigrok from source on macOS using a guide from Shawn (pico-coder) [1] but it always fails the „tests“. > > I had to do a few tweaks (as pico-coder did) to the sigrok-native-macosx.sh script from the sigrok-utils repo, e.g. change qt@5.5 to qt@5 since 5.5 is not on homebrew anymore. > > As the script instructed me to report back to you: here I am! If you want me to test anything I would be thrilled to contribute to this project! > > Best regards, > Lars > > > -- This message may contain traces of Truth. |
From: Lars U. <lar...@ic...> - 2024-03-06 22:22:38
|
Hi dev team, I am trying to build sigrok from source on macOS using a guide from Shawn (pico-coder) [1] but it always fails the „tests“. I had to do a few tweaks (as pico-coder did) to the sigrok-native-macosx.sh script from the sigrok-utils repo, e.g. change qt@5.5 to qt@5 since 5.5 is not on homebrew anymore. As the script instructed me to report back to you: here I am! If you want me to test anything I would be thrilled to contribute to this project! Best regards, Lars |
From: Marco S. <ma...@si...> - 2024-03-01 03:27:36
|
Woops, didn't catch the mime type mess going on with this one: Hey all, Would it be possible to put out a new release for sigrok-firmware-fx2lafw? The current latest release fails compilation with the whole: ``` ./fx2lib/include/fx2regs.h:269: syntax error: token -> '+' ; column 27 ``` (see here: https://bugs.gentoo.org/913396) which I think was fixed in 96b0b4 last year. But also the last release 0.1.7 was in 2019. Would it be possible to put out a new one? Anything I can do to help (testing, etc)? Thanks, -- Marco Sirabella |
From: Andy Lu <lz...@gm...> - 2024-02-29 02:55:54
|
@Uwe Hermann Could you help, Please ? I find same issue and fixed the bug for kingst-la2016 , could you please fixed it for logicstudio and rebuild it for win64 install package ? https://github.com/sigrokproject/libsigrok/pull/112 Fix kingst-la2016 driver (for windows) #112 There are two fixes for bugs that inhibit the driver to operate with the Windows 10 USB driver. 1. When uploading the firmware, the correct configuration must be selected. 2. The*attribute*((*packed*)) is not accepted by the MXE compiler and an invalid transfer is sent to the USB device. Each fix is in a separate commit. Best Regards Andy Lu > > Dear All, > > I want using pulseview with my lecroy logicstudio16, i had install > winusb drive and extera the bitstream file , it seem > > no problem to connection ,but it will report capture failed when i > clik start button. see the log as below : > > sr: resource: Opened 'C:\Program > Files\sigrok\PulseView\share\sigrok-firmware\lecroy-logicstudio16-16.bitstream'. > > sr: session: Using thread-default main context. > > sr: session: Starting. > > sr: hwdriver: lecroy-logicstudio: Starting acquisition. > > sr: session: bus: Received SR_DF_HEADER packet. > > sr: usb: Failed to get libusb file descriptors. > > sr: session: Could not start lecroy-logicstudio device usb/7-6 > acquisition. > > sr: hwdriver: lecroy-logicstudio: Stopping acquisition. > > Notifying user of session error: "Capture failed" ; > "generic/unspecified error" > > > Could you help ,please ? > > > Best Regards > Andy Lu > |
From: Tomas M. <mud...@sp...> - 2024-02-28 11:29:56
|
From a7179b2b36688c86ed3d055d0c4119ac2d63a782 Mon Sep 17 00:00:00 2001 From: Tomas Mudrunka <tom...@gm...> Date: Tue, 6 Feb 2024 21:07:01 +0100 Subject: [PATCH v5] Support use of soundcard as oscilloscope via SDL2 PATCH v5: - fixed freeze when using pulse protocol with pipewire - fixed JACK compatibility (forcing integer samples for now) PATCH v4 has modifications based on IRC discussion with abraxa_ Most notably: - Fixed datatype for result of SDL_GetNumAudioDevices() - Using SR_UNIT_UNITLESS instead of SR_UNIT_VOLT - Audio subsystem initialization and scanning is more verbose, giving out useful details for debuging purposes - Better error handling - Code was formated to comply with sigrok rules Signed-off-by: Tomas Mudrunka <mud...@sp...> --- Makefile.am | 5 + configure.ac | 3 + src/hardware/sdl2/api.c | 390 +++++++++++++++++++++++++++++++++++ src/hardware/sdl2/protocol.h | 49 +++++ 4 files changed, 447 insertions(+) create mode 100644 src/hardware/sdl2/api.c create mode 100644 src/hardware/sdl2/protocol.h diff --git a/Makefile.am b/Makefile.am index 62aca8ac..2fc45077 100644 --- a/Makefile.am +++ b/Makefile.am @@ -341,6 +341,11 @@ src_libdrivers_la_SOURCES += \ src/hardware/devantech-eth008/protocol.c \ src/hardware/devantech-eth008/api.c endif +if HW_SDL2 +src_libdrivers_la_SOURCES += \ + src/hardware/sdl2/protocol.h \ + src/hardware/sdl2/api.c +endif if HW_DREAMSOURCELAB_DSLOGIC src_libdrivers_la_SOURCES += \ src/hardware/dreamsourcelab-dslogic/protocol.h \ diff --git a/configure.ac b/configure.ac index 5c30a816..9d1ff751 100644 --- a/configure.ac +++ b/configure.ac @@ -113,6 +113,8 @@ SR_ARG_OPT_PKG([libserialport], [LIBSERIALPORT], , SR_ARG_OPT_PKG([libftdi], [LIBFTDI], , [libftdi1 >= 1.0]) +SR_ARG_OPT_PKG([libsdl2], [LIBSDL], , [sdl2 >= 2.0]) + # pkg-config file names: MinGW/MacOSX: hidapi; Linux: hidapi-hidraw/-libusb SR_ARG_OPT_PKG([libhidapi], [LIBHIDAPI], , [hidapi >= 0.8.0], [hidapi-hidraw >= 0.8.0], [hidapi-libusb >= 0.8.0]) @@ -373,6 +375,7 @@ SR_DRIVER([Saleae Logic16], [saleae-logic16], [libusb]) SR_DRIVER([Saleae Logic Pro], [saleae-logic-pro], [libusb]) SR_DRIVER([SCPI DMM], [scpi-dmm]) SR_DRIVER([SCPI PPS], [scpi-pps]) +SR_DRIVER([sdl2], [sdl2], [libsdl2]) SR_DRIVER([serial DMM], [serial-dmm], [serial_comm]) SR_DRIVER([serial LCR], [serial-lcr], [serial_comm]) SR_DRIVER([Siglent SDS], [siglent-sds]) diff --git a/src/hardware/sdl2/api.c b/src/hardware/sdl2/api.c new file mode 100644 index 00000000..1c2e442c --- /dev/null +++ b/src/hardware/sdl2/api.c @@ -0,0 +1,390 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2022-2024 Tomas Mudrunka <har...@gm...> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <config.h> +#include "protocol.h" +#include <SDL2/SDL.h> + +#define INPUT_BUFFER_SIZE 65536 + +static const uint32_t drvopts[] = { + SR_CONF_OSCILLOSCOPE, + SR_CONF_LOGIC_ANALYZER, +}; + +static const uint32_t devopts[] = { + SR_CONF_LIMIT_SAMPLES | SR_CONF_SET, + SR_CONF_SAMPLERATE | SR_CONF_GET, +}; + +static const char *channel_names[] = { + //Channel names for 7.1 DS Audio: + //Front-Left, Front-Right, Center, LowFreq, Surround-Left, Surround-Right, Hearing-Impaired, Visualy-Impaired, etc... + "FL", "FR", "CE", "LF", "SL", "SR", "HI", "VI", "CL", "CR", "RSL", "RSR", "CH13", "CH14", "CH15", "CH16", "PLSSTOP", "SRSLY", +}; + +int SDL_GetAudioDeviceSpec_open(int index, int iscapture, SDL_AudioSpec *spec); +int SDL_GetAudioDeviceSpec_open(int index, int iscapture, SDL_AudioSpec *spec) +{ + //ALSA does not allow to fully read specs of device without opening it. + //This wrapper tries to open device when SDL_GetAudioDeviceSpec() reports device to have 0 channels. + //See https://github.com/libsdl-org/SDL/blob/237348c772b4ff0e758ace83f471dbf8570535e2/src/audio/alsa/SDL_alsa_audio.c#L759 + + int ret = SDL_GetAudioDeviceSpec(index, iscapture, spec); + if (!ret && spec->channels == 0) { + sr_err("Failed SDL_GetAudioDeviceSpec(), trying to open device to get specs."); + SDL_AudioDeviceID d; + d = SDL_OpenAudioDevice(SDL_GetAudioDeviceName(index, iscapture), + iscapture, spec, spec, SDL_AUDIO_ALLOW_ANY_CHANGE); + if (d) + SDL_CloseAudioDevice(d); + } + + //This is hack to disable floating point samples before we figure out how to properly pass them to sigrok + if(!ret && SDL_AUDIO_ISFLOAT(spec->format)) spec->format = AUDIO_S32SYS; + + return ret; +} + +static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) +{ + SDL_version compiled; + SDL_version linked; + + SDL_VERSION(&compiled); + SDL_GetVersion(&linked); + + sr_err("Compiled with SDL v%u.%u.%u and linked with SDL v%u.%u.%u", + compiled.major, compiled.minor, compiled.patch, + linked.major, linked.minor, linked.patch); + + if (SDL_Init(SDL_INIT_AUDIO)) { + sr_err("Audio init failed: %s", SDL_GetError()); + return SR_ERR; + } + return std_init(di, sr_ctx); +} + +static int cleanup(const struct sr_dev_driver *di) +{ + SDL_Quit(); + return std_cleanup(di); +} + +static GSList *scan(struct sr_dev_driver *di, GSList *options) +{ + (void)options; + + GSList *devices = NULL; + struct dev_context *devc; + struct sr_dev_inst *sdi; + struct sr_channel *ch; + struct sr_channel_group *acg; + + int dev_count = SDL_GetNumAudioDevices(1); + int dev_i; + SDL_AudioSpec dev_spec; + + const char *audio_driver = SDL_GetCurrentAudioDriver(); + sr_err("Audio driver %s found %d capture (and %d playback) devices", + audio_driver ? audio_driver : "UNKNOWN", dev_count, + SDL_GetNumAudioDevices(0)); + + for (dev_i = 0; dev_i < dev_count; ++dev_i) { + if (SDL_GetAudioDeviceSpec_open(dev_i, 1, &dev_spec)) + continue; + + //Create driver specific data (priv) structure for driver instance + devc = g_malloc0(sizeof(struct dev_context)); + memcpy(&devc->sdl_device_spec, &dev_spec, sizeof(SDL_AudioSpec)); + devc->sdl_device_index = dev_i; + devc->sdl_device_name = SDL_GetAudioDeviceName(dev_i, 1); + + //Create device instance + sdi = g_malloc0(sizeof(struct sr_dev_inst)); + sdi->status = SR_ST_INACTIVE; + sdi->model = g_strdup_printf("[#%d, %dch, %dHz] %s", dev_i, + dev_spec.channels, dev_spec.freq, devc->sdl_device_name); + sdi->priv = devc; //Reference to driver specific data + devices = g_slist_append(devices, sdi); //Add device to list + + //Create analog channel group + acg = g_malloc0(sizeof(struct sr_channel_group)); + acg->name = g_strdup("Analog"); + sdi->channel_groups = g_slist_append(sdi->channel_groups, acg); + + int ch_i; + for (ch_i = 0; ch_i < dev_spec.channels; ch_i++) { + //Put new channel to group + ch = sr_channel_new(sdi, ch_i, SR_CHANNEL_ANALOG, TRUE, + channel_names[ch_i]); + acg->channels = g_slist_append(acg->channels, ch); + } + } + + return std_scan_complete(di, devices); +} + +static int dev_open(struct sr_dev_inst *sdi) +{ + struct dev_context *devc; + + devc = sdi->priv; + + //Check if SDL device is still available + SDL_AudioSpec dev_spec; + if (SDL_GetAudioDeviceSpec_open(devc->sdl_device_index, 1, &dev_spec)) + return SR_ERR; + + //TODO: flush buffer? + + return SR_OK; +} + +static int config_get(unsigned int key, GVariant **data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) +{ + struct dev_context *devc; + + (void)cg; + + if (!sdi) + return SR_ERR_ARG; + + devc = sdi->priv; + + switch (key) { + case SR_CONF_LIMIT_SAMPLES: + *data = g_variant_new_uint64(devc->limit_samples); + break; + case SR_CONF_SAMPLERATE: + *data = g_variant_new_uint64(SR_HZ(devc->sdl_device_spec.freq)); + break; + default: + return SR_ERR_NA; + } + + return SR_OK; +} + +static int config_set(unsigned int key, GVariant *data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) +{ + struct dev_context *devc; + uint64_t num_samples; + + (void)cg; + + devc = sdi->priv; + + switch (key) { + case SR_CONF_SAMPLERATE: + // FIXME + return SR_ERR_NA; + case SR_CONF_LIMIT_SAMPLES: + num_samples = g_variant_get_uint64(data); + sr_err("Received config to limit samples: %lu", num_samples); + devc->limit_samples = num_samples; + break; + default: + return SR_ERR_NA; + } + + return SR_OK; +} + +static int config_list(unsigned int key, GVariant **data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) +{ + if (cg) + return SR_ERR_NA; //Cannot handle this right now + + switch (key) { + case SR_CONF_DEVICE_OPTIONS: + return STD_CONFIG_LIST(key, data, sdi, cg, NO_OPTS, drvopts, + devopts); + default: + return SR_ERR_NA; + } + + return SR_OK; +} + +static int dev_acquisition_stop(struct sr_dev_inst *sdi); +int sdl_data_callback(int fd, int revents, void *cb_data); +int sdl_data_callback(int fd, int revents, void *cb_data) +{ + (void)fd; + (void)revents; + + struct sr_dev_inst *sdi; + struct dev_context *devc; + struct sr_datafeed_packet packet; + struct sr_datafeed_analog packet_analog; + + struct sr_analog_encoding encoding; + struct sr_analog_meaning meaning; + struct sr_analog_spec spec; + + struct sr_rational r_scale, r_offset; + + sdi = cb_data; + devc = sdi->priv; + + if (devc->limit_samples_remaining <= + 0 /* || devc->limit_samples_remaining > 65535 */) { //Already sent everything + sr_err("Loop finished"); + std_session_send_df_end(sdi); + SDL_CloseAudioDevice(devc->sdl_device_handle); + return SR_OK; + } + + sr_analog_init(&packet_analog, &encoding, &meaning, &spec, 0); + + struct sr_channel_group *lastcg = g_slist_nth_data(sdi->channel_groups, 0); + + SDL_AudioFormat sf; + sf = devc->sdl_device_spec.format; + + //TODO: lot of stuff done here should actualy be prepared only once during aquisition start! + + if (SDL_AUDIO_ISFLOAT(sf)) + sr_err("Float samples are not really correctly implemented yet!"); + + //encoding + encoding.unitsize = SDL_AUDIO_BITSIZE(sf) / 8; //??? + encoding.is_signed = SDL_AUDIO_ISSIGNED(sf); + encoding.is_float = SDL_AUDIO_ISFLOAT(sf); + encoding.is_bigendian = SDL_AUDIO_ISBIGENDIAN(sf); + encoding.digits = 2; + encoding.is_digits_decimal = 1; + r_scale.p = 1; + r_scale.q = SDL_FORMAT_MAX_VAL(sf) / 2; //Scale so that MAX signal is always +-1 volt //TODO: user configurable calibration + r_offset.p = SDL_AUDIO_ISSIGNED(sf) ? 0 : -1; //Center unsigned audio samples to enable negative voltages + r_offset.q = 1; + encoding.scale = r_scale; + encoding.offset = r_offset; + spec.spec_digits = 2; + + //meaning + meaning.mq = SR_MQ_VOLTAGE; + meaning.unit = SR_UNIT_UNITLESS; + meaning.mqflags = 0; + meaning.channels = lastcg->channels; + + //data + uint8_t data[INPUT_BUFFER_SIZE]; + uint32_t requ_bytes = INPUT_BUFFER_SIZE; + if (requ_bytes > SDL_SAMPLES_TO_BYTES(devc->limit_samples_remaining, + devc->sdl_device_spec)) + requ_bytes = SDL_SAMPLES_TO_BYTES(devc->limit_samples_remaining, + devc->sdl_device_spec); + + uint32_t recv_bytes = 0; + recv_bytes = SDL_DequeueAudio(devc->sdl_device_handle, data, requ_bytes); + + packet_analog.data = data; + packet_analog.num_samples = 4; + packet_analog.encoding = &encoding; + packet_analog.meaning = &meaning; + packet_analog.spec = &spec; + packet_analog.num_samples = SDL_BYTES_TO_SAMPLES(recv_bytes, + devc->sdl_device_spec); + + //packet + packet.type = SR_DF_ANALOG; + packet.payload = &packet_analog; + + if(packet_analog.num_samples) sr_session_send(sdi, &packet); + devc->limit_samples_remaining -= packet_analog.num_samples; + + return G_SOURCE_CONTINUE; +} + +static int dev_acquisition_start(const struct sr_dev_inst *sdi) +{ + struct dev_context *devc; + devc = sdi->priv; + + devc->limit_samples_remaining = devc->limit_samples; + sr_err("Limiting samples to %lu", devc->limit_samples_remaining); + + //Initialize SDL2 recording + devc->sdl_device_spec.callback = NULL; + devc->sdl_device_spec.samples = SDL_BYTES_TO_SAMPLES(INPUT_BUFFER_SIZE, + devc->sdl_device_spec); + + devc->sdl_device_handle = SDL_OpenAudioDevice(devc->sdl_device_name, 1, + &devc->sdl_device_spec, NULL, 0); + if (!devc->sdl_device_handle) { + sr_err("Could not open device for capture!"); + return SR_ERR; + } + //SDL_ClearQueuedAudio(devc->sdl_device_handle); + SDL_PauseAudioDevice(devc->sdl_device_handle, 0); + + sr_session_source_add(sdi->session, -1, 0, 100, sdl_data_callback, + (struct sr_dev_inst *)sdi); + + std_session_send_df_header(sdi); + + return SR_OK; +} + +static int dev_acquisition_stop(struct sr_dev_inst *sdi) +{ + sr_err("STOP Initiated"); + + struct dev_context *devc; + devc = sdi->priv; + + devc->limit_samples_remaining = 0; + + return SR_OK; +} + +static struct sr_dev_driver sdl2_driver_info = { + .name = "sdl2", + .longname = "SoundCard Audio Capture using SDL2", + .api_version = 1, + .init = init, + .cleanup = cleanup, + + //scan + .scan = scan, + .dev_list = std_dev_list, + .dev_clear = std_dev_clear, + + //config + .config_get = config_get, + .config_set = config_set, + .config_list = config_list, + + //open + .dev_open = dev_open, + .dev_close = std_dummy_dev_close, + + //acq + .dev_acquisition_start = dev_acquisition_start, + .dev_acquisition_stop = dev_acquisition_stop, + + //inst + .context = NULL, +}; +SR_REGISTER_DEV_DRIVER(sdl2_driver_info); diff --git a/src/hardware/sdl2/protocol.h b/src/hardware/sdl2/protocol.h new file mode 100644 index 00000000..c383ba49 --- /dev/null +++ b/src/hardware/sdl2/protocol.h @@ -0,0 +1,49 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2022 Tomas Mudrunka <har...@gm...> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef LIBSIGROK_HARDWARE_SDL2_PROTOCOL_H +#define LIBSIGROK_HARDWARE_SDL2_PROTOCOL_H + +#define SDL_SAMPLES_TO_BYTES(bytes, spec) \ + ((bytes) * ((SDL_AUDIO_BITSIZE((spec).format) / 8) * ((spec).channels))) +#define SDL_BYTES_TO_SAMPLES(bytes, spec) \ + ((bytes) / SDL_SAMPLES_TO_BYTES(1, (spec))) +#define SDL_FORMAT_MAX_VAL(f) \ + (1ull << (SDL_AUDIO_BITSIZE(f) - SDL_AUDIO_ISSIGNED(f))) + +#include <stdint.h> +#include <string.h> +#include <glib.h> +#include <libsigrok/libsigrok.h> +#include "libsigrok-internal.h" +#include <SDL2/SDL.h> + +#define LOG_PREFIX "sdl2-audio-interface" + +struct dev_context { + const char *sdl_device_name; + SDL_AudioDeviceID sdl_device_index; + SDL_AudioSpec sdl_device_spec; + SDL_AudioDeviceID sdl_device_handle; + + uint64_t limit_samples; + uint64_t limit_samples_remaining; +}; + +#endif -- 2.44.0 |
From: Andy Lu <lz...@gm...> - 2024-02-28 10:29:35
|
Dear All, I want using pulseview with my lecroy logicstudio16, i had install winusb drive and extera the bitstream file , it seem no problem to connection ,but it will report capture failed when i clik start button. see the log as below : sr: resource: Opened 'C:\Program Files\sigrok\PulseView\share\sigrok-firmware\lecroy-logicstudio16-16.bitstream'. sr: session: Using thread-default main context. sr: session: Starting. sr: hwdriver: lecroy-logicstudio: Starting acquisition. sr: session: bus: Received SR_DF_HEADER packet. sr: usb: Failed to get libusb file descriptors. sr: session: Could not start lecroy-logicstudio device usb/7-6 acquisition. sr: hwdriver: lecroy-logicstudio: Stopping acquisition. Notifying user of session error: "Capture failed" ; "generic/unspecified error" Could you help ,please ? Best Regards Andy Lu |
From: Tomas M. <mud...@sp...> - 2024-02-26 15:44:29
|
Signed-off-by: Tomas Mudrunka <mud...@sp...> --- PATCH v4 has modifications based on IRC discussion with abraxa_ Most notably: - Fixed datatype for result of SDL_GetNumAudioDevices() - Using SR_UNIT_UNITLESS instead of SR_UNIT_VOLT - Audio subsystem initialization and scanning is more verbose, giving out useful details for debuging purposes - Better error handling - Code was formated to comply with sigrok rules Makefile.am | 5 + configure.ac | 3 + src/hardware/sdl2/api.c | 392 +++++++++++++++++++++++++++++++++++ src/hardware/sdl2/protocol.h | 49 +++++ 4 files changed, 449 insertions(+) create mode 100644 src/hardware/sdl2/api.c create mode 100644 src/hardware/sdl2/protocol.h diff --git a/Makefile.am b/Makefile.am index 62aca8ac..2fc45077 100644 --- a/Makefile.am +++ b/Makefile.am @@ -341,6 +341,11 @@ src_libdrivers_la_SOURCES += \ src/hardware/devantech-eth008/protocol.c \ src/hardware/devantech-eth008/api.c endif +if HW_SDL2 +src_libdrivers_la_SOURCES += \ + src/hardware/sdl2/protocol.h \ + src/hardware/sdl2/api.c +endif if HW_DREAMSOURCELAB_DSLOGIC src_libdrivers_la_SOURCES += \ src/hardware/dreamsourcelab-dslogic/protocol.h \ diff --git a/configure.ac b/configure.ac index 5c30a816..9d1ff751 100644 --- a/configure.ac +++ b/configure.ac @@ -113,6 +113,8 @@ SR_ARG_OPT_PKG([libserialport], [LIBSERIALPORT], , SR_ARG_OPT_PKG([libftdi], [LIBFTDI], , [libftdi1 >= 1.0]) +SR_ARG_OPT_PKG([libsdl2], [LIBSDL], , [sdl2 >= 2.0]) + # pkg-config file names: MinGW/MacOSX: hidapi; Linux: hidapi-hidraw/-libusb SR_ARG_OPT_PKG([libhidapi], [LIBHIDAPI], , [hidapi >= 0.8.0], [hidapi-hidraw >= 0.8.0], [hidapi-libusb >= 0.8.0]) @@ -373,6 +375,7 @@ SR_DRIVER([Saleae Logic16], [saleae-logic16], [libusb]) SR_DRIVER([Saleae Logic Pro], [saleae-logic-pro], [libusb]) SR_DRIVER([SCPI DMM], [scpi-dmm]) SR_DRIVER([SCPI PPS], [scpi-pps]) +SR_DRIVER([sdl2], [sdl2], [libsdl2]) SR_DRIVER([serial DMM], [serial-dmm], [serial_comm]) SR_DRIVER([serial LCR], [serial-lcr], [serial_comm]) SR_DRIVER([Siglent SDS], [siglent-sds]) diff --git a/src/hardware/sdl2/api.c b/src/hardware/sdl2/api.c new file mode 100644 index 00000000..3e84ca72 --- /dev/null +++ b/src/hardware/sdl2/api.c @@ -0,0 +1,392 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2022-2024 Tomas Mudrunka <har...@gm...> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <config.h> +#include "protocol.h" +#include <SDL2/SDL.h> + +#define INPUT_BUFFER_SIZE 65536 + +static const uint32_t drvopts[] = { + SR_CONF_OSCILLOSCOPE, + SR_CONF_LOGIC_ANALYZER, +}; + +static const uint32_t devopts[] = { + SR_CONF_LIMIT_SAMPLES | SR_CONF_SET, + SR_CONF_SAMPLERATE | SR_CONF_GET, +}; + +static const char *channel_names[] = { + //Channel names for 7.1 DS Audio: + //Front-Left, Front-Right, Center, LowFreq, Surround-Left, Surround-Right, Hearing-Impaired, Visualy-Impaired, etc... + "FL", "FR", "CE", "LF", "SL", "SR", "HI", "VI", "CL", "CR", "RSL", "RSR", "CH13", "CH14", "CH15", "CH16", "PLSSTOP", "SRSLY", +}; + +int SDL_GetAudioDeviceSpec_open(int index, int iscapture, SDL_AudioSpec *spec); +int SDL_GetAudioDeviceSpec_open(int index, int iscapture, SDL_AudioSpec *spec) +{ + //ALSA does not allow to fully read specs of device without opening it. + //This wrapper tries to open device when SDL_GetAudioDeviceSpec() reports device to have 0 channels. + //See https://github.com/libsdl-org/SDL/blob/237348c772b4ff0e758ace83f471dbf8570535e2/src/audio/alsa/SDL_alsa_audio.c#L759 + + int ret = SDL_GetAudioDeviceSpec(index, iscapture, spec); + if (!ret && spec->channels == 0) { + sr_err("Failed SDL_GetAudioDeviceSpec(), trying to open device to get specs."); + SDL_AudioDeviceID d; + d = SDL_OpenAudioDevice(SDL_GetAudioDeviceName(index, iscapture), + iscapture, spec, spec, SDL_AUDIO_ALLOW_ANY_CHANGE); + if (d) + SDL_CloseAudioDevice(d); + } + return ret; +} + +static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) +{ + SDL_version compiled; + SDL_version linked; + + SDL_VERSION(&compiled); + SDL_GetVersion(&linked); + + sr_err("Compiled with SDL v%u.%u.%u and linked with SDL v%u.%u.%u", + compiled.major, compiled.minor, compiled.patch, + linked.major, linked.minor, linked.patch); + + if (SDL_Init(SDL_INIT_AUDIO)) { + sr_err("Audio init failed: %s", SDL_GetError()); + return SR_ERR; + } + return std_init(di, sr_ctx); +} + +static int cleanup(const struct sr_dev_driver *di) +{ + SDL_Quit(); + return std_cleanup(di); +} + +static GSList *scan(struct sr_dev_driver *di, GSList *options) +{ + (void)options; + + GSList *devices = NULL; + struct dev_context *devc; + struct sr_dev_inst *sdi; + struct sr_channel *ch; + struct sr_channel_group *acg; + + int dev_count = SDL_GetNumAudioDevices(1); + int dev_i; + SDL_AudioSpec dev_spec; + + const char *audio_driver = SDL_GetCurrentAudioDriver(); + sr_err("Audio driver %s found %d capture (and %d playback) devices", + audio_driver ? audio_driver : "UNKNOWN", dev_count, + SDL_GetNumAudioDevices(0)); + + for (dev_i = 0; dev_i < dev_count; ++dev_i) { + if (SDL_GetAudioDeviceSpec_open(dev_i, 1, &dev_spec)) + continue; + + //Create driver specific data (priv) structure for driver instance + devc = g_malloc0(sizeof(struct dev_context)); + memcpy(&devc->sdl_device_spec, &dev_spec, sizeof(SDL_AudioSpec)); + devc->sdl_device_index = dev_i; + devc->sdl_device_name = SDL_GetAudioDeviceName(dev_i, 1); + + //Create device instance + sdi = g_malloc0(sizeof(struct sr_dev_inst)); + sdi->status = SR_ST_INACTIVE; + sdi->model = g_strdup_printf("[#%d, %dch, %dHz] %s", dev_i, + dev_spec.channels, dev_spec.freq, devc->sdl_device_name); + sdi->priv = devc; //Reference to driver specific data + devices = g_slist_append(devices, sdi); //Add device to list + + //Create analog channel group + acg = g_malloc0(sizeof(struct sr_channel_group)); + acg->name = g_strdup("Analog"); + sdi->channel_groups = g_slist_append(sdi->channel_groups, acg); + + int ch_i; + for (ch_i = 0; ch_i < dev_spec.channels; ch_i++) { + //Put new channel to group + ch = sr_channel_new(sdi, ch_i, SR_CHANNEL_ANALOG, TRUE, + channel_names[ch_i]); + acg->channels = g_slist_append(acg->channels, ch); + } + } + + return std_scan_complete(di, devices); +} + +static int dev_open(struct sr_dev_inst *sdi) +{ + struct dev_context *devc; + + devc = sdi->priv; + + //Check if SDL device is still available + SDL_AudioSpec dev_spec; + if (SDL_GetAudioDeviceSpec_open(devc->sdl_device_index, 1, &dev_spec)) + return SR_ERR; + + //TODO: flush buffer? + + return SR_OK; +} + +static int config_get(unsigned int key, GVariant **data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) +{ + struct dev_context *devc; + + (void)cg; + + if (!sdi) + return SR_ERR_ARG; + + devc = sdi->priv; + + switch (key) { + case SR_CONF_LIMIT_SAMPLES: + *data = g_variant_new_uint64(devc->limit_samples); + break; + case SR_CONF_SAMPLERATE: + *data = g_variant_new_uint64(SR_HZ(devc->sdl_device_spec.freq)); + break; + default: + return SR_ERR_NA; + } + + return SR_OK; +} + +static int config_set(unsigned int key, GVariant *data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) +{ + struct dev_context *devc; + uint64_t num_samples; + + (void)cg; + + devc = sdi->priv; + + switch (key) { + case SR_CONF_SAMPLERATE: + // FIXME + return SR_ERR_NA; + case SR_CONF_LIMIT_SAMPLES: + num_samples = g_variant_get_uint64(data); + sr_err("Received config to limit samples: %lu", num_samples); + devc->limit_samples = num_samples; + break; + default: + return SR_ERR_NA; + } + + return SR_OK; +} + +static int config_list(unsigned int key, GVariant **data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) +{ + if (cg) + return SR_ERR_NA; //Cannot handle this right now + + switch (key) { + case SR_CONF_DEVICE_OPTIONS: + return STD_CONFIG_LIST(key, data, sdi, cg, NO_OPTS, drvopts, + devopts); + default: + return SR_ERR_NA; + } + + return SR_OK; +} + +static int dev_acquisition_stop(struct sr_dev_inst *sdi); +int sdl_data_callback(int fd, int revents, void *cb_data); +int sdl_data_callback(int fd, int revents, void *cb_data) +{ + (void)fd; + (void)revents; + + struct sr_dev_inst *sdi; + struct dev_context *devc; + struct sr_datafeed_packet packet; + struct sr_datafeed_analog packet_analog; + + struct sr_analog_encoding encoding; + struct sr_analog_meaning meaning; + struct sr_analog_spec spec; + + struct sr_rational r_scale, r_offset; + + sdi = cb_data; + devc = sdi->priv; + + if (devc->limit_samples_remaining <= + 0 /* || devc->limit_samples_remaining > 65535 */) { //Already sent everything + sr_err("Loop finished"); + std_session_send_df_end(sdi); + SDL_CloseAudioDevice(devc->sdl_device_handle); + return SR_OK; + } + + sr_analog_init(&packet_analog, &encoding, &meaning, &spec, 0); + + struct sr_channel_group *lastcg = g_slist_nth_data(sdi->channel_groups, 0); + + SDL_AudioFormat sf; + sf = devc->sdl_device_spec.format; + + //TODO: lot of stuff done here should actualy be prepared only once during aquisition start! + + if (SDL_AUDIO_ISFLOAT(sf)) + sr_err("Float samples are not really correctly implemented yet!"); + + //encoding + encoding.unitsize = SDL_AUDIO_BITSIZE(sf) / 8; //??? + encoding.is_signed = SDL_AUDIO_ISSIGNED(sf); + encoding.is_float = SDL_AUDIO_ISFLOAT(sf); + encoding.is_bigendian = SDL_AUDIO_ISBIGENDIAN(sf); + encoding.digits = 2; + encoding.is_digits_decimal = 1; + r_scale.p = 1; + r_scale.q = SDL_FORMAT_MAX_VAL(sf) / + 2; //Scale so that MAX signal is always +-1 volt //TODO: user configurable calibration + r_offset.p = SDL_AUDIO_ISSIGNED(sf) + ? 0 + : -1; //Center unsigned audio samples to enable negative voltages + r_offset.q = 1; + encoding.scale = r_scale; + encoding.offset = r_offset; + spec.spec_digits = 2; + + //meaning + meaning.mq = SR_MQ_VOLTAGE; + meaning.unit = SR_UNIT_UNITLESS; + meaning.mqflags = 0; + meaning.channels = lastcg->channels; + + //data + uint8_t data[INPUT_BUFFER_SIZE]; + uint32_t requ_bytes = INPUT_BUFFER_SIZE; + if (requ_bytes > SDL_SAMPLES_TO_BYTES(devc->limit_samples_remaining, + devc->sdl_device_spec)) + requ_bytes = SDL_SAMPLES_TO_BYTES(devc->limit_samples_remaining, + devc->sdl_device_spec); + + uint32_t recv_bytes = 0; + while (!recv_bytes) { + recv_bytes = SDL_DequeueAudio(devc->sdl_device_handle, data, + requ_bytes); + SDL_Delay(100); + } + + packet_analog.data = data; + packet_analog.num_samples = 4; + packet_analog.encoding = &encoding; + packet_analog.meaning = &meaning; + packet_analog.spec = &spec; + packet_analog.num_samples = SDL_BYTES_TO_SAMPLES(recv_bytes, + devc->sdl_device_spec); + + //packet + packet.type = SR_DF_ANALOG; + packet.payload = &packet_analog; + + sr_session_send(sdi, &packet); + devc->limit_samples_remaining -= packet_analog.num_samples; + + return G_SOURCE_CONTINUE; +} + +static int dev_acquisition_start(const struct sr_dev_inst *sdi) +{ + struct dev_context *devc; + devc = sdi->priv; + + devc->limit_samples_remaining = devc->limit_samples; + sr_err("Limiting samples to %lu", devc->limit_samples_remaining); + + //Initialize SDL2 recording + devc->sdl_device_spec.callback = NULL; + devc->sdl_device_spec.samples = SDL_BYTES_TO_SAMPLES(INPUT_BUFFER_SIZE, + devc->sdl_device_spec); + + devc->sdl_device_handle = SDL_OpenAudioDevice(devc->sdl_device_name, 1, + &devc->sdl_device_spec, NULL, 0); + if (!devc->sdl_device_handle) { + sr_err("Could not open device for capture!"); + return SR_ERR; + } + SDL_PauseAudioDevice(devc->sdl_device_handle, 0); + + sr_session_source_add(sdi->session, -1, 0, 100, sdl_data_callback, + (struct sr_dev_inst *)sdi); + + std_session_send_df_header(sdi); + + return SR_OK; +} + +static int dev_acquisition_stop(struct sr_dev_inst *sdi) +{ + sr_err("STOP Initiated"); + + struct dev_context *devc; + devc = sdi->priv; + + devc->limit_samples_remaining = 0; + + return SR_OK; +} + +static struct sr_dev_driver sdl2_driver_info = { + .name = "sdl2", + .longname = "SoundCard Audio Capture using SDL2", + .api_version = 1, + .init = init, + .cleanup = cleanup, + + //scan + .scan = scan, + .dev_list = std_dev_list, + .dev_clear = std_dev_clear, + + //config + .config_get = config_get, + .config_set = config_set, + .config_list = config_list, + + //open + .dev_open = dev_open, + .dev_close = std_dummy_dev_close, + + //acq + .dev_acquisition_start = dev_acquisition_start, + .dev_acquisition_stop = dev_acquisition_stop, + + //inst + .context = NULL, +}; +SR_REGISTER_DEV_DRIVER(sdl2_driver_info); diff --git a/src/hardware/sdl2/protocol.h b/src/hardware/sdl2/protocol.h new file mode 100644 index 00000000..c383ba49 --- /dev/null +++ b/src/hardware/sdl2/protocol.h @@ -0,0 +1,49 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2022 Tomas Mudrunka <har...@gm...> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef LIBSIGROK_HARDWARE_SDL2_PROTOCOL_H +#define LIBSIGROK_HARDWARE_SDL2_PROTOCOL_H + +#define SDL_SAMPLES_TO_BYTES(bytes, spec) \ + ((bytes) * ((SDL_AUDIO_BITSIZE((spec).format) / 8) * ((spec).channels))) +#define SDL_BYTES_TO_SAMPLES(bytes, spec) \ + ((bytes) / SDL_SAMPLES_TO_BYTES(1, (spec))) +#define SDL_FORMAT_MAX_VAL(f) \ + (1ull << (SDL_AUDIO_BITSIZE(f) - SDL_AUDIO_ISSIGNED(f))) + +#include <stdint.h> +#include <string.h> +#include <glib.h> +#include <libsigrok/libsigrok.h> +#include "libsigrok-internal.h" +#include <SDL2/SDL.h> + +#define LOG_PREFIX "sdl2-audio-interface" + +struct dev_context { + const char *sdl_device_name; + SDL_AudioDeviceID sdl_device_index; + SDL_AudioSpec sdl_device_spec; + SDL_AudioDeviceID sdl_device_handle; + + uint64_t limit_samples; + uint64_t limit_samples_remaining; +}; + +#endif -- 2.44.0 |
From: Marco S. <ma...@si...> - 2024-02-23 05:04:09
|
Hey all, Would it be possible to put out a new release for sigrok-firmware-fx2lafw? The current latest release fails compilation with the whole: ``` ./fx2lib/include/fx2regs.h:269: syntax error: token -> '+' ; column 27 ``` (see here: https://bugs.gentoo.org/913396) which I think was fixed in 96b0b4 last year. But also the last release 0.1.7 was in 2019. Would it be possible to put out a new one? Anything I can do to help (testing, etc)? Thanks, -- Marco Sirabella |
From: Volker O. <Vol...@gm...> - 2024-02-18 14:10:49
|
Hi, I recently ported my SENT SAE J2716 decoder (which I wrote in 2014 for ScanaStudio) to Sigrok/Python. The repository can be found here: https://bitbucket.org/fade0ff/sigrok_decoder_sent The implementation is based on the SAE J2716 from 2010. There are test samples included in Sigrok/PulseView (pvs/*.sr) and DSView (*dsl) format to test all the features of the decoder (serial decoding, error handling). The file "SENT test cases.txt" describes these test cases. Regards Volker Oth |
From: Tomas M. <mud...@sp...> - 2024-02-06 22:52:54
|
This is new version of soundcard oscilloscope support patch. Updated to latest git version of libsigrok and improved ALSA support. --- Makefile.am | 5 + configure.ac | 3 + src/hardware/sdl2/api.c | 344 +++++++++++++++++++++++++++++++++++ src/hardware/sdl2/protocol.h | 46 +++++ 4 files changed, 398 insertions(+) create mode 100644 src/hardware/sdl2/api.c create mode 100644 src/hardware/sdl2/protocol.h diff --git a/Makefile.am b/Makefile.am index 62aca8ac..2fc45077 100644 --- a/Makefile.am +++ b/Makefile.am @@ -341,6 +341,11 @@ src_libdrivers_la_SOURCES += \ src/hardware/devantech-eth008/protocol.c \ src/hardware/devantech-eth008/api.c endif +if HW_SDL2 +src_libdrivers_la_SOURCES += \ + src/hardware/sdl2/protocol.h \ + src/hardware/sdl2/api.c +endif if HW_DREAMSOURCELAB_DSLOGIC src_libdrivers_la_SOURCES += \ src/hardware/dreamsourcelab-dslogic/protocol.h \ diff --git a/configure.ac b/configure.ac index 5c30a816..9d1ff751 100644 --- a/configure.ac +++ b/configure.ac @@ -113,6 +113,8 @@ SR_ARG_OPT_PKG([libserialport], [LIBSERIALPORT], , SR_ARG_OPT_PKG([libftdi], [LIBFTDI], , [libftdi1 >= 1.0]) +SR_ARG_OPT_PKG([libsdl2], [LIBSDL], , [sdl2 >= 2.0]) + # pkg-config file names: MinGW/MacOSX: hidapi; Linux: hidapi-hidraw/-libusb SR_ARG_OPT_PKG([libhidapi], [LIBHIDAPI], , [hidapi >= 0.8.0], [hidapi-hidraw >= 0.8.0], [hidapi-libusb >= 0.8.0]) @@ -373,6 +375,7 @@ SR_DRIVER([Saleae Logic16], [saleae-logic16], [libusb]) SR_DRIVER([Saleae Logic Pro], [saleae-logic-pro], [libusb]) SR_DRIVER([SCPI DMM], [scpi-dmm]) SR_DRIVER([SCPI PPS], [scpi-pps]) +SR_DRIVER([sdl2], [sdl2], [libsdl2]) SR_DRIVER([serial DMM], [serial-dmm], [serial_comm]) SR_DRIVER([serial LCR], [serial-lcr], [serial_comm]) SR_DRIVER([Siglent SDS], [siglent-sds]) diff --git a/src/hardware/sdl2/api.c b/src/hardware/sdl2/api.c new file mode 100644 index 00000000..835a7553 --- /dev/null +++ b/src/hardware/sdl2/api.c @@ -0,0 +1,344 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2022 Tomas Mudrunka <har...@gm...> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <config.h> +#include "protocol.h" +#include <SDL2/SDL.h> + +#define INPUT_BUFFER_SIZE 65536 + +static const uint32_t drvopts[] = { + SR_CONF_OSCILLOSCOPE, + SR_CONF_LOGIC_ANALYZER, +}; + +static const uint32_t devopts[] = { + SR_CONF_LIMIT_SAMPLES | SR_CONF_SET, + SR_CONF_SAMPLERATE | SR_CONF_GET, +}; + +static const char *channel_names[] = { + //Channel names for 7.1 DS Audio: + //Front-Left, Front-Right, Center, LowFreq, Surround-Left, Surround-Right, Hearing-Impaired, Visualy-Impaired, etc... + "FL", "FR", "CE", "LF", "SL", "SR", "HI", "VI", "CL", "CR", "RSL", "RSR", "CH13", "CH14", "CH15", "CH16", "PLSSTOP", "SRSLY", +}; + +int SDL_GetAudioDeviceSpec_open(int index, int iscapture, SDL_AudioSpec *spec); +int SDL_GetAudioDeviceSpec_open(int index, int iscapture, SDL_AudioSpec *spec) +{ + //ALSA does not allow to fully read specs of device without opening it. + //This wrapper tries to open device when SDL_GetAudioDeviceSpec() reports device to have 0 channels. + //See https://github.com/libsdl-org/SDL/blob/237348c772b4ff0e758ace83f471dbf8570535e2/src/audio/alsa/SDL_alsa_audio.c#L759 + + int ret = SDL_GetAudioDeviceSpec(index, iscapture, spec); + if(!ret && spec->channels == 0) { + sr_err("Failed SDL_GetAudioDeviceSpec(), trying to open device to get specs."); + SDL_AudioDeviceID d; + d = SDL_OpenAudioDevice(SDL_GetAudioDeviceName(index, iscapture), iscapture, spec, spec, SDL_AUDIO_ALLOW_ANY_CHANGE); + if(d) SDL_CloseAudioDevice(d); + } + return ret; +} + +static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) +{ + SDL_Init(SDL_INIT_AUDIO); + return std_init(di, sr_ctx); +} + +static int cleanup(const struct sr_dev_driver *di) +{ + SDL_Quit(); + return std_cleanup(di); +} + +static GSList *scan(struct sr_dev_driver *di, GSList *options) +{ + (void)options; + + GSList *devices = NULL; + struct dev_context *devc; + struct sr_dev_inst *sdi; + struct sr_channel *ch; + struct sr_channel_group *acg; + + SDL_AudioDeviceID dev_count = SDL_GetNumAudioDevices(0); + SDL_AudioDeviceID dev_i; + SDL_AudioSpec dev_spec; + + for (dev_i = 0; dev_i < dev_count; ++dev_i) { + if (SDL_GetAudioDeviceSpec_open(dev_i, 1, &dev_spec)) continue; + + //Create driver specific data (priv) structure for driver instance + devc = g_malloc0(sizeof(struct dev_context)); + memcpy(&devc->sdl_device_spec, &dev_spec, sizeof(SDL_AudioSpec)); + devc->sdl_device_index = dev_i; + devc->sdl_device_name = SDL_GetAudioDeviceName(dev_i, 1); + + //Create device instance + sdi = g_malloc0(sizeof(struct sr_dev_inst)); + sdi->status = SR_ST_INACTIVE; + sdi->model = g_strdup_printf("[#%d, %dch, %dHz] %s", dev_i, dev_spec.channels, dev_spec.freq, devc->sdl_device_name); + sdi->priv = devc; //Reference to driver specific data + devices = g_slist_append(devices, sdi); //Add device to list + + //Create analog channel group + acg = g_malloc0(sizeof(struct sr_channel_group)); + acg->name = g_strdup("Analog"); + sdi->channel_groups = g_slist_append(sdi->channel_groups, acg); + + int ch_i; + for (ch_i = 0; ch_i < dev_spec.channels; ch_i++) { + //Put new channel to group + ch = sr_channel_new(sdi, ch_i, SR_CHANNEL_ANALOG, TRUE, channel_names[ch_i]); + acg->channels = g_slist_append(acg->channels, ch); + } + } + + return std_scan_complete(di, devices); +} + +static int dev_open(struct sr_dev_inst *sdi) +{ + struct dev_context *devc; + + devc = sdi->priv; + + //Check if SDL device is still available + SDL_AudioSpec dev_spec; + if (SDL_GetAudioDeviceSpec_open(devc->sdl_device_index, 1, &dev_spec)) return SR_ERR; + + //TODO: flush buffer? + + return SR_OK; +} + +static int config_get(unsigned int key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) +{ + struct dev_context *devc; + + (void)cg; + + if (!sdi) return SR_ERR_ARG; + + devc = sdi->priv; + + switch (key) { + case SR_CONF_LIMIT_SAMPLES: *data = g_variant_new_uint64(devc->limit_samples); break; + case SR_CONF_SAMPLERATE: *data = g_variant_new_uint64(SR_HZ(devc->sdl_device_spec.freq)); break; + default: return SR_ERR_NA; + } + + return SR_OK; +} + +static int config_set(unsigned int key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) +{ + struct dev_context *devc; + uint64_t num_samples; + + (void)cg; + + devc = sdi->priv; + + switch (key) { + case SR_CONF_SAMPLERATE: + // FIXME + return SR_ERR_NA; + case SR_CONF_LIMIT_SAMPLES: + num_samples = g_variant_get_uint64(data); + sr_err("Received config to limit samples: %lu", num_samples); + devc->limit_samples = num_samples; + break; + default: return SR_ERR_NA; + } + + return SR_OK; +} + +static int config_list(unsigned int key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) +{ + if(cg) return SR_ERR_NA; //Cannot handle this right now + + switch (key) { + case SR_CONF_DEVICE_OPTIONS: + return STD_CONFIG_LIST(key, data, sdi, cg, NO_OPTS, drvopts, devopts); + default: + return SR_ERR_NA; + } + + return SR_OK; +} + +static int dev_acquisition_stop(struct sr_dev_inst *sdi); +int sdl_data_callback(int fd, int revents, void *cb_data); +int sdl_data_callback(int fd, int revents, void *cb_data) +{ + (void)fd; + (void)revents; + + struct sr_dev_inst *sdi; + struct dev_context *devc; + struct sr_datafeed_packet packet; + struct sr_datafeed_analog packet_analog; + + struct sr_analog_encoding encoding; + struct sr_analog_meaning meaning; + struct sr_analog_spec spec; + + struct sr_rational r_scale, r_offset; + + sdi = cb_data; + devc = sdi->priv; + + if (devc->limit_samples_remaining <= 0 /* || devc->limit_samples_remaining > 65535 */ ) { //Already sent everything + sr_err("Loop finished"); + std_session_send_df_end(sdi); + SDL_CloseAudioDevice(devc->sdl_device_handle); + return SR_OK; + } + + sr_analog_init(&packet_analog, &encoding, &meaning, &spec, 0); + + struct sr_channel_group *lastcg = g_slist_nth_data(sdi->channel_groups, 0); + + SDL_AudioFormat sf; + sf = devc->sdl_device_spec.format; + + //TODO: lot of stuff done here should actualy be prepared only once during aquisition start! + + if(SDL_AUDIO_ISFLOAT(sf)) sr_err("SDL2 float samples are not really correctly implemented yet!"); + + //encoding + encoding.unitsize = SDL_AUDIO_BITSIZE(sf) / 8; //??? + encoding.is_signed = SDL_AUDIO_ISSIGNED(sf); + encoding.is_float = SDL_AUDIO_ISFLOAT(sf); + encoding.is_bigendian = SDL_AUDIO_ISBIGENDIAN(sf); + encoding.digits = 2; + encoding.is_digits_decimal = 1; + r_scale.p = 1; + r_scale.q = SDL_FORMAT_MAX_VAL(sf)/2; //Scale so that MAX signal is always +-1 volt //TODO: user configurable calibration + r_offset.p = SDL_AUDIO_ISSIGNED(sf) ? 0 : -1; //Center unsigned audio samples to enable negative voltages + r_offset.q = 1; + encoding.scale = r_scale; + encoding.offset = r_offset; + spec.spec_digits = 2; + + //meaning + meaning.mq = SR_MQ_VOLTAGE; + meaning.unit = SR_UNIT_VOLT; + meaning.mqflags = 0; + meaning.channels = lastcg->channels; + + //data + uint8_t data[INPUT_BUFFER_SIZE]; + uint32_t requ_bytes = INPUT_BUFFER_SIZE; + if(requ_bytes > SDL_SAMPLES_TO_BYTES(devc->limit_samples_remaining, devc->sdl_device_spec)) + requ_bytes = SDL_SAMPLES_TO_BYTES(devc->limit_samples_remaining, devc->sdl_device_spec); + + uint32_t recv_bytes = 0; + while(!recv_bytes) { + recv_bytes = SDL_DequeueAudio(devc->sdl_device_handle, data, requ_bytes); + SDL_Delay(100); + } + + packet_analog.data = data; + packet_analog.num_samples = 4; + packet_analog.encoding = &encoding; + packet_analog.meaning = &meaning; + packet_analog.spec = &spec; + packet_analog.num_samples = SDL_BYTES_TO_SAMPLES(recv_bytes, devc->sdl_device_spec); + + //packet + packet.type = SR_DF_ANALOG; + packet.payload = &packet_analog; + + sr_session_send(sdi, &packet); + devc->limit_samples_remaining -= packet_analog.num_samples; + + return G_SOURCE_CONTINUE; +} + +static int dev_acquisition_start(const struct sr_dev_inst *sdi) +{ + struct dev_context *devc; + devc = sdi->priv; + + devc->limit_samples_remaining = devc->limit_samples; + sr_err("Limiting samples to %lu", devc->limit_samples_remaining); + + //Initialize SDL2 recording + devc->sdl_device_spec.callback=NULL; + devc->sdl_device_spec.samples = SDL_BYTES_TO_SAMPLES(INPUT_BUFFER_SIZE, devc->sdl_device_spec); + + devc->sdl_device_handle = SDL_OpenAudioDevice(devc->sdl_device_name, 1, &devc->sdl_device_spec, NULL, 0); + if(!devc->sdl_device_handle) { + sr_err("Could not open SDL2 device for capture!"); + return SR_ERR; + } + SDL_PauseAudioDevice(devc->sdl_device_handle, 0); + + sr_session_source_add(sdi->session, -1, 0, 100, sdl_data_callback, (struct sr_dev_inst *)sdi); + + std_session_send_df_header(sdi); + + return SR_OK; +} + +static int dev_acquisition_stop(struct sr_dev_inst *sdi) +{ + sr_err("STOP Initiated"); + + struct dev_context *devc; + devc = sdi->priv; + + devc->limit_samples_remaining = 0; + + return SR_OK; +} + +static struct sr_dev_driver sdl2_driver_info = { + .name = "sdl2", + .longname = "SoundCard Audio Capture using SDL2", + .api_version = 1, + .init = init, + .cleanup = cleanup, + + //scan + .scan = scan, + .dev_list = std_dev_list, + .dev_clear = std_dev_clear, + + //config + .config_get = config_get, + .config_set = config_set, + .config_list = config_list, + + //open + .dev_open = dev_open, + .dev_close = std_dummy_dev_close, + + //acq + .dev_acquisition_start = dev_acquisition_start, + .dev_acquisition_stop = dev_acquisition_stop, + + //inst + .context = NULL, +}; +SR_REGISTER_DEV_DRIVER(sdl2_driver_info); diff --git a/src/hardware/sdl2/protocol.h b/src/hardware/sdl2/protocol.h new file mode 100644 index 00000000..49134c59 --- /dev/null +++ b/src/hardware/sdl2/protocol.h @@ -0,0 +1,46 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2022 Tomas Mudrunka <har...@gm...> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef LIBSIGROK_HARDWARE_SDL2_PROTOCOL_H +#define LIBSIGROK_HARDWARE_SDL2_PROTOCOL_H + +#define SDL_SAMPLES_TO_BYTES(bytes,spec) ((bytes)*((SDL_AUDIO_BITSIZE((spec).format)/8)*((spec).channels))) +#define SDL_BYTES_TO_SAMPLES(bytes,spec) ((bytes)/SDL_SAMPLES_TO_BYTES(1,(spec))) +#define SDL_FORMAT_MAX_VAL(f) (1ull<<(SDL_AUDIO_BITSIZE(f)-SDL_AUDIO_ISSIGNED(f))) + +#include <stdint.h> +#include <string.h> +#include <glib.h> +#include <libsigrok/libsigrok.h> +#include "libsigrok-internal.h" +#include <SDL2/SDL.h> + +#define LOG_PREFIX "sdl2-audio-interface" + +struct dev_context { + const char* sdl_device_name; + SDL_AudioDeviceID sdl_device_index; + SDL_AudioSpec sdl_device_spec; + SDL_AudioDeviceID sdl_device_handle; + + uint64_t limit_samples; + uint64_t limit_samples_remaining; +}; + +#endif -- 2.43.0 |
From: Paul \LeoNerd\ E. <le...@le...> - 2024-02-06 22:13:08
|
On Sun, 4 Feb 2024 12:28:10 +0100 Helge Kruse via sigrok-devel <sig...@li...> wrote: > On 30.01.2024 23:47, Paul "LeoNerd" Evans wrote: > > It's quite early yet, in that it successfully parses and runs some > > tests on a few capture files I have of some simple cases, but I'm > > sure a lot of work is still needed to add more decoding of other > > situations and so on. > > It would be helpful to add more information about the UPDI protocol. > Can you send a link to the protocol specification? The protocol itself doesn't appear to have a standalone document, but it can be seen in any of the more recent AVR chip data sheets. For example, the AVR 32 DA 28/32/48 datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/AVR32DA28-32-48-DataSheet-DS40002228A.pdf chapter 35 goes into some detail about it. -- Paul "LeoNerd" Evans le...@le... | https://metacpan.org/author/PEVANS http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/ |
From: Filip K. <fil...@gm...> - 2024-02-06 16:47:21
|
Hello, I added an input module to libsigrok which handles input files in Tektronix ISF format that is used by Tektronix devices ( https://www.tek.com/en/support/faqs/what-format-isf-file). The main advantage of this format is that data is loaded faster than, for instance, data stored in a CSV file. I've created a GitHub pull request at https://github.com/sigrokproject/libsigrok/pull/238, so feel free to leave a review/comment. Best regards, Filip Kosecek |
From: Helge K. <Hel...@gm...> - 2024-02-04 11:28:26
|
On 30.01.2024 23:47, Paul "LeoNerd" Evans wrote: > It's quite early yet, in that it successfully parses and runs some > tests on a few capture files I have of some simple cases, but I'm sure > a lot of work is still needed to add more decoding of other situations > and so on. It would be helpful to add more information about the UPDI protocol. Can you send a link to the protocol specification? Regards, Helge |
From: Paul \LeoNerd\ E. <le...@le...> - 2024-01-30 23:06:15
|
Hi all, I'm working on a decoder for the newer "UPDI" programming interface used by many of the newer AVR chips from Microchip (who bought Atmel a few years ago, in case you were wondering ;) ) There's a work-in-progress sitting at https://github.com/leonerd/libsigrokdecode/tree/avr_updi https://github.com/leonerd/libsigrokdecode/tree/avr_updi/decoders/avr_updi It's quite early yet, in that it successfully parses and runs some tests on a few capture files I have of some simple cases, but I'm sure a lot of work is still needed to add more decoding of other situations and so on. There's also dumpfiles and tests at https://github.com/leonerd/sigrok-dumps/tree/avr_updi/avr_updi https://github.com/leonerd/sigrok-test/tree/avr_updi But I thought I'd pause here for a moment first to see if anyone had any feedback on what I have so far, before I continue. Once it looks good I'll submit it all as a sequence of patches in whatever is the usually preferred fashion. Thanks, -- Paul "LeoNerd" Evans le...@le... | https://metacpan.org/author/PEVANS http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/ |
From: Cedric de W. <ced...@ec...> - 2024-01-27 17:15:57
|
I'm trying to cross compile sigrok for linux, in an arch linux system. My plan is to make a new user, grab MXE, and then use sigrok-cross-linux to compile pulseview. Here we go: 1) Create the new user: [cedric@cedric ~]$ su Password: [root@cedric cedric]# useradd sigrok [root@cedric cedric]# mkdir /home/sigrok [root@cedric cedric]# chown sigrok /home//sigrok/ [root@cedric cedric]# su sigrok [sigrok@cedric cedric]$ cd [sigrok@cedric ~]$ pwd /home/sigrok [sigrok@cedric ~]$ 2) get MXE: $ git clone https://github.com/mxe/mxe.git 3) get sigrok-cross-mingw $ git clone git://sigrok.org/sigrok-util 4) compile pulseview: $ cd ~/sigrok-util/cross-compile/linux $ ./sigrok-cross-linux The compile fails with errors like this: (The full console output is attached) What did i miss? GEN bindings/java/org/sigrok/core/classes/doc.i GEN src/libdrivers.lo GEN bindings/ruby/classes_wrap.cpp GEN bindings/java/org/sigrok/core/classes/classes_wrap.cxx bindings/swig/enums.i:1: Error: Unknown directive '%attribute'. make[1]: *** [Makefile:5953: bindings/java/org/sigrok/core/classes/classes_wrap.cxx] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:2211: all] Error 2 _________________________________________________________________ ________________________________________________________ Your E-Mail. Your Cloud. Your Office. eclipso Mail Europe. https://www.eclipso.de |
From: Cedric de W. <ced...@ec...> - 2024-01-27 15:58:55
|
I'm trying to cross compile pulseview for windows, in an arch Linux system. My plan is to make a new user, grab MXE, and then use sigrok-cross-mingw to compile pulseview. Here we go: 1) Create the new user: [cedric@cedric ~]$ su Password: [root@cedric cedric]# useradd sigrok [root@cedric cedric]# mkdir /home/sigrok [root@cedric cedric]# chown sigrok /home//sigrok/ [root@cedric cedric]# su sigrok [sigrok@cedric cedric]$ cd [sigrok@cedric ~]$ pwd /home/sigrok [sigrok@cedric ~]$ 2) get MXE: $ git clone https://github.com/mxe/mxe.git 3) get sigrok-cross-mingw $ git clone git://sigrok.org/sigrok-util 4) compile pulseview: $ cd sigrok-util/cross-compile/mingw/ $ ./sigrok-cross-mingw The compile fails with errors like this: (The full console output is attached) What did i miss? make all-am CC serialport.lo CC timing.lo CC windows.lo windows.c:27:52: error: unknown type name 'DEVINST' 27 | const char *parent_path, DEVINST dev_inst); | ^~~~~~~ windows.c:29:25: error: unknown type name 'PWCHAR' 29 | static char *wc_to_utf8(PWCHAR wc_buffer, ULONG wc_bytes) | ^~~~~~ windows.c:29:43: error: unknown type name 'ULONG' 29 | static char *wc_to_utf8(PWCHAR wc_buffer, ULONG wc_bytes) | ^~~~~ windows.c:68:32: error: unknown type name 'HANDLE' 68 | static char *get_root_hub_name(HANDLE host_controller) | ^~~~~~ windows.c:98:36: error: unknown type name 'HANDLE' 98 | static char *get_external_hub_name(HANDLE hub, ULONG connection_index) | ^~~~~~ windows.c:98:48: error: unknown type name 'ULONG' 98 | static char *get_external_hub_name(HANDLE hub, ULONG connection_index) | ^~~~~ windows.c:133:36: error: unknown type name 'HANDLE' 133 | static char *get_string_descriptor(HANDLE hub_device, ULONG connection_index, | ^~~~~~ windows.c:133:55: error: unknown type name 'ULONG' 133 | static char *get_string_descriptor(HANDLE hub_device, ULONG connection_index, _________________________________________________________________ ________________________________________________________ Your E-Mail. Your Cloud. Your Office. eclipso Mail Europe. https://www.eclipso.de |
From: Erik S. <eri...@li...> - 2024-01-12 15:04:23
|
So far one could only specify yes/no (optionally for all drivers through --enable-all-drivers={yes,no}). However, even when stating a =yes, the dependency check would override it to a =no if the dependencies are missing. This is a bit annoying for scripts since a script may specify --enable-foo-driver=yes but in fact the build may not contain `foo-driver` due to missing build dependencies. This is especially problematic for distro's which look like they currently do not build a defined driver set - which results in random drivers missing [1]. This fixes that by following the autoconf examples [2] that allow a third state `check`. With that `no` means no, `yes` means yes (raise an error if deps are unavailable) and `check` gracefully disables drivers with unavailable dependencies. With that --enable-all-drivers can be used to ensure that all drivers are built in. Certain drivers can still be explicitly disabled by overriding the individual driver setting. This way distros can specify --enable-all-drivers and new drivers with unmet dependencies will cause an error rather than silently getting dropped of the build. [1] https://sigrok.org/bugzilla/show_bug.cgi?id=1699 [2] https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/External-Software.html#External-Software To: sig...@li... Cc: Daniel Thompson <dan...@li...> --- I realized that Fedora only builds libsigrok with a somewhat random set of enabled drivers. It also seems to cause ambigious situations for the appimage builds. This proposes a more explicit and less error-prone method of specifying the drivers expected to be built in. --- configure.ac | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 5c30a816..a509a89d 100644 --- a/configure.ac +++ b/configure.ac @@ -277,26 +277,31 @@ sr_check_driver_deps() { [SR_APPEND([sr_deps_missing], [', '], [$sr_dep])]) done test -z "$sr_deps_missing" || return 1 } AC_ARG_ENABLE([all-drivers], [AS_HELP_STRING([--enable-all-drivers], - [enable all drivers by default [default=yes]])], - [], [enable_all_drivers=yes]) + [enable all drivers by default [default=check]])], + [], [enable_all_drivers=check]) ## _SR_DRIVER(Device name, driver-name, var-name, [dependencies...]) m4_define([_SR_DRIVER], [ AC_ARG_ENABLE([$2], [AS_HELP_STRING([--enable-$2], [enable $1 support])], [$3=$enableval], [$3=$enable_all_drivers]) - AS_IF([test "x[$]$3" = xyes], [sr_hw_info=yes[]m4_ifval([$4], [ + AS_IF([test "x[$]$3" != xno], + [sr_hw_info=yes[]m4_ifval([$4], [ sr_check_driver_deps $4 \ - || $3=no sr_hw_info="no (missing: $sr_deps_missing)" + || if test "x[$]$3" != xcheck; then + AC_MSG_ERROR([driver $2 is enabled, but deps are missing: $sr_deps_missing]) + else + $3=no sr_hw_info="no (missing: $sr_deps_missing)" + fi; ])], [sr_hw_info='no (disabled)']) sr_driver_summary_append "$2" "$sr_hw_info" AM_CONDITIONAL([$3], [test "x[$]$3" = xyes]) AM_COND_IF([$3], [AC_DEFINE([HAVE_$3], [1], [Whether to support $1 device.]) AC_DEFINE([HAVE_DRIVERS], [1], [Whether at least one driver is enabled.])]) ]) --- base-commit: b503d24cdf56abf8c0d66d438ccac28969f01670 change-id: 20240112-tweak-enable-all-drivers-7e02a3e567f3 Best regards, -- Erik Schilling <eri...@li...> |
From: Gisle V. <gv...@ya...> - 2024-01-08 11:14:18
|
Hello list, my 1st port. I've built the 'libsigrok.dll' okay using clang-cl (on Windows), I think. But now I'm struggling building the C++ / Python binding of libsigrok. Especially the 'enums.hpp' file. Looking at Doxyfile, it seems to me there is a circular reference (in gnumake terms) to this file; it is marked as INPUT in Doxyfile and 'doxy/xml/index.xml' should be a by-product of running 'doxygen Doxyfile'. Right? So when 'enums.py doxy/xml/index.xml' get to run, I end up with an empty 'enums.hpp' file. How is this supposed to work? So could somebody please send me the output of a working 'enums.hpp'. -- --gv |
From: Zoe N. <zoe...@gm...> - 2024-01-07 17:37:38
|
Hello, I have my custom data stream in python, how can I stream it into sigrok/pulseview and have it displayed real time? Preferably over UDP/TCP. Something like: timestamp 0.00012s ch name "system state" value: 5 timestamp 0.00015s ch name "system state2" value: 666 cheers, Zoe |
From: Kosma M. <ko...@ko...> - 2024-01-03 19:19:57
|
On Mon, 9 Oct 2023 at 11:32, yyjdelete <yyj...@12...> wrote: > Test on Windows x64 + sigrok FX2 LA (8ch), recently nightly builds stops > immediately with the below log, and the old version works well with the > same PC and devices. > > sr: usb: Failed to get libusb file descriptors. > Has there been any development in that regard? The build has been broken for a few months now, and there's no way to acquire the old binaries (they're not on archive.org). -- Kosma Moczek http://www.kosma.pl/ |
From: holo h. <sug...@gm...> - 2024-01-01 01:51:42
|
Hi, It was self resolved as follows >set PD_PINS=dio1=D0:dio2=D1:dio3=D2:dio4=D3:dio5=D4:dio6=D5:dio7=D6:dio8=D7:eoi=D8:dav=D9:nrfd=D10:ndac=D11:ifc=D12:srq=D13:atn=D14:ren=D15 >sigrok-cli --config samplerate=12M --driver=fx2lafw --continuous -P ieee488:%PD_PINS% -A ieee488=texts -t D14=r >ieee488-1: *IDN? >ieee488-1: KEITHLEY INSTRUMENTS INC.,MODEL 2400,1350411,C32 Oct 4 2010 14:20:11/A02 /R/J[LF] THX 2023年12月31日(日) 15:55 holo holo <sug...@gm...>: > Hi, > > I am new to this tool, so forgive me if this is a trivial question. > > I want to realtime sniffing Ieee488 bus with sigrok-cli & fx2lafw. > I can already sniffing Ieee488 bus with pulseview & Cypress FX2. > And,I can read pulseview results to use sigrok-cli like follows. > > >C:\Program Files\sigrok\sigrok-cli>set > PD_PINS=dio1=DIO1:dio2=DIO2:dio3=DIO3:dio4=DIO4:dio5=DIO5:dio6=DIO6:dio7=DIO7:dio8=DIO8:eoi=EOI:dav=DAV:nrfd=NRFD:ndac=NDAC:ifc=IFC:srq=SRQ:atn=ATN:ren=REN > >C:\Program Files\sigrok\sigrok-cli>sigrok-cli -i test1.sr -P > ieee488:%PD_PINS% -A ieee488=texts > ieee488-1: *IDN? > ieee488-1: TEKTRONIX,TDS 3024B,0,CF:91.1CT FV:v3.4 TDS3GV:v1.00 > TDS3FFT:v1.00 TDS3TRG:v1.00[LF] > > I can not understand setup details. > Pls teach me. > I'd like to know how to define as follows, [1],[2],[3] > > [1] Pin assign > > >C:\Program Files\sigrok\sigrok-cli>set > PD_PINS=D0=DIO1:D1=DIO2:D2=DIO3:D3=DIO4:D4=DIO5:D5=DIO6:D6=DIO7:D7=DIO8:D8=EOI:D9=DAV:D10=NRFD:D11=NDAC:D12=IFC:D13=SRQ:D14=ATN:D15=REN > >C:\Program Files\sigrok\sigrok-cli>sigrok-cli --config samplerate=1M > --driver=fx2lafw --continuous -P ieee488:%PD_PINS% -A ieee488=texts > >Unknown option or channel 'D15' > > [2] tigger > > >C:\Program Files\sigrok\sigrok-cli>sigrok-cli --config samplerate=1M > --driver=fx2lafw --continuous -P ieee488 -A ieee488=texts -t atn=r > >Invalid channel 'atn'. > > [3] iec_periph > > >C:\Program Files\sigrok\sigrok-cli>sigrok-cli --config samplerate=3M > --driver=fx2lafw --continuous -P ieee488:%PD_PINS% -A > ieee488=texts:iec_periph=1 > >Unknown option or channel 'ATN' > |