AlexUg / sigrok

33 stars 7 forks source link

Trying to follow the steps #7

Closed Tyrn closed 3 years ago

Tyrn commented 3 years ago

Hi,

I'm not an experienced user, sorry. I did the following:

  1. Installed PulseView from repositories (Manjaro, more or less the same as Archlinux).

  2. I'm not quite sure I'm checking the right thing:

    $ whereis libsigrok
    libsigrok: /usr/include/libsigrok
    $ whereis libsigrok.so
    libsigrok.so: /usr/lib/libsigrok.so
  3. Followed all the steps without any errors that I am aware of:

    $ whereis libsigrok
    libsigrok: /usr/include/libsigrok
    $ whereis libsigrok.so
    libsigrok.so: /usr/lib/libsigrok.so /usr/local/lib/libsigrok.so

    I suppose PulseView still uses the libsigrok library from the repositories. What should I do?

  4. Patching Makefile, no trouble:

    ...
    am__append_46 = \
    src/hardware/kingst-la1010/protocol.h \
    src/hardware/kingst-la1010/protocol.c \
    src/hardware/kingst-la1010/api.c
    ...
  5. Patching configure.ac is rejected, can't tell why; I just added a line manually:

    SR_DRIVER([Kingst LA2016], [kingst-la2016], [libusb])
    SR_DRIVER([Kingst LA1010], [kingst-la1010], [libusb])

What else do I have to do? Besides the newly built libsigrok library availability, I'm uneasy about two things: (1) which driver shoud I choose from the PulseView dropdown menu? There's nothing suggestive of Kingst there. (2) I don't have to update any actual firmware inside the device, or do I?

Sorry, if some of my questions are stupid. Or all of them...

AlexUg commented 3 years ago

The best way is to rebuild the packages for Manjaro, but I will not be able to help in this matter. The second way is to build everything from the sources (including libsigrokdecode and PulseView). As for the questions: (1) in PulseView the 'Kingst LA-1010 driver (kingst-la1010)' must be present in the drop-down list, you need to select this driver. But usually PulseView detects the device itself and uses the necessary driver. (2) the firmware inside the device is loaded when the device is activated in PulseView (see point 6 in the README).

AlexUg commented 3 years ago

You can try replacing the /usr/lib/libsigrok.so file with the compiled /usr/local/lib/libsigrok.so. But this is a terrible way and it is better not to use it.

Tyrn commented 3 years ago

Thanks!

In the PulseView dropdown list there should be at least one Kingst driver, as LA2016 is officially supported. There is none. The dropdown list is pretty heavily populated, about 30 entries, but no Kingst.

Tyrn commented 3 years ago

I did it the "terrible way", experimentally.

before:

$ ls -lh /usr/lib/libsigrok.so
lrwxrwxrwx 1 root root 18 Mar 20 01:36 /usr/lib/libsigrok.so -> libsigrok.so.4.1.1

after:

$ sudo rm /usr/lib/libsigrok.so
$ sudo ln -s /usr/local/lib/libsigrok.so.4.0.0 /usr/lib/libsigrok.so
$ ls -lh /usr/lib/libsigrok.so                                    
lrwxrwxrwx 1 root root 33 Jul 27 09:53 /usr/lib/libsigrok.so -> /usr/local/lib/libsigrok.so.4.0.0

It works just as before. Still no Kingst drivers. Not even LA2016, which needs some explanation.

UPD:

Oh, there is hope! The AUR PulseView version (the AUR packages are being built from source, Gentoo fashion) shows Kingst LA2016 driver. All I have to do is apply your patches and build it again. Curiously, the AUR version is older.

...
aur/pulseview-git 0.3.0.r744.g0adee2d-1 (+10 0.00) (Installed: 0.3.0.r1110.ga6fa4d47-1)
    A Qt based logic analyzer GUI for sigrok. (git version)
community/pulseview 0.4.2-5 (766.9 KiB 2.5 MiB) 
    A Qt based logic analyzer GUI for sigrok
...
Tyrn commented 3 years ago

Build and install successful. It finds Kingst LA1010 with 16 channels, then Failed to open device generic/unspecified error. Can it be a problem with the wrong firmware?

Extracted from the current KingstVIS 3.5.3 for Linux.

$ ls ~/.local/share/sigrok-firmware
fw01A1.fw   fw01A2.hex  fw01A4.fw   LA1010A0.bitstream  LA1016A1.bitstream  LA2016.bitstream    LA5016.bitstream    MS6218.bitstream
fw01A1.hex  fw01A3.fw   fw03A1.fw   LA1010A1.bitstream  LA1016.bitstream    LA5016A1.bitstream  LA5032A0.bitstream
fw01A2.fw   fw01A3.hex  fw03A1.hex  LA1010A2.bitstream  LA2016A1.bitstream  LA5016A3.bitstream  LA5032A3.bitstream

UPD: Downloaded KingstVIS 3.4.1; still unspecified error. Removed everything not mentioned in the description:

/.local/share/sigrok-firmware $ ls
fw01A2.fw  fw01A2.hex  LA1010A_0.bitstream

unspecified error persists.

AlexUg commented 3 years ago

To identify the problem, you need to run PulseView in the console with the command:

pulseview -l 5
Tyrn commented 3 years ago
...
sr: [00:15.736594] bt-bluez: BLE scan (BT)
sr: [00:15.736661] bt-bluez: BLE open
sr: [00:19.431125] serial-bt: BT scan, found: 40:49:0F:5A:09:36 - KD-49XD8099
sr: [00:19.431260] bt-bluez: BLE close
sr: [00:19.431351] bt-bluez: BLE scan (LE)
sr: [00:19.431411] bt-bluez: BLE open
set LE scan params: Operation not permitted
sr: [00:19.431638] bt-bluez: BLE close
sr: [00:22.692075] kingst-la1010: kingst_la1010_has_fx_firmware(): iface->altsetting->bNumEndpoints: 4
sr: [00:22.693180] ezusb: setting CPU reset mode on...
sr: [00:22.694514] resource: Opened '/home/alexey/.local/share/sigrok-firmware/fw01A2.hex'.
sr: [00:22.763556] ezusb: setting CPU reset mode off...
sr: [00:22.763806] kingst-la1010: FX2 firmware was uploaded to Kingst LA1010 device.
sr: [00:22.763957] hwdriver: Scan found 1 devices (kingst-la1010).
sr: [00:27.185682] device: kingst-la1010: Opening device instance.
sr: [00:27.185731] kingst-la1010: Waiting for device to reset.
sr: [00:27.610978] kingst-la1010: Opened device on 1.8 (logical) / usb/1-1.1 (physical), interface 0
sr: [00:27.611071] kingst-la1010: Device came back after 0ms.
sr: [00:27.611170] kingst-la1010: Checking Cypress firmware...
sr: [00:27.611332] kingst-la1010: kingst_la1010_has_fx_firmware(): iface->altsetting->bNumEndpoints: 4
sr: [00:27.611360] kingst-la1010: Cypress wasn't initialized. Return status: 0xffffffff
Notifying user of session error: "generic/unspecified error"
AlexUg commented 3 years ago

The approximate essence of the problem is clear, but I will be able to find out more precisely everything only in three weeks (I don't have access to the device right now).

Tyrn commented 3 years ago

That's OK. And the broken configure.ac.patch too :)

Tyrn commented 3 years ago

Just a reminder. I remember that you are a busy person :)

AlexUg commented 3 years ago

Thank you for the reminder. I have returned home and will be able to study the essence of the problem in more detail. However, I will be able to study only in the evening after the main work.

AlexUg commented 3 years ago

After a detailed study, the cause of the problem has not been fully clarified. In the log you presented:

sr: [00:22.763806] kingst-la1010: FX2 firmware was uploaded to Kingst LA1010 device.
sr: [00:22.763957] hwdriver: Scan found 1 devices (kingst-la1010).
sr: [00:27.185682] device: kingst-la1010: Opening device instance.
sr: [00:27.185731] kingst-la1010: Waiting for device to reset.
sr: [00:27.610978] kingst-la1010: Opened device on 1.8 (logical) / usb/1-1.1 (physical), interface 0
sr: [00:27.611071] kingst-la1010: Device came back after 0ms.
sr: [00:27.611170] kingst-la1010: Checking Cypress firmware...
sr: [00:27.611332] kingst-la1010: kingst_la1010_has_fx_firmware(): iface->altsetting->khj 

I see the following: the firmware is loaded into the Cypress USB-controller, but for some reason the USB-controller is not rebooted with the new firmware (or there is no waiting for the USB-controller to reboot), as a result of which 'sigrok' sees that the Cypress USB-controller with the default firmware and fails.

Also, there was a conflict between plugins LA-2016 and LA-1010. So I forked libsigrok (https://github.com/AlexUg/libsigrok) and made the necessary fixes there. Try use this fork for building 'libsigrok'.

But that's not all. There is a suspicion that the data format has changed in the new firmwares, pulseview shows incorrect graphs. Supported firmwares can be found in version 3.4.0 (see http://www.qdkingst.com/en/vis-old).

I'll figure problems with new software out, but I don't know how long it may take.

AlexUg commented 3 years ago

After extracting firmware from 3.4.x:

cp ~/.local/share/sigrok-firmware/LA1010A_0.bitstream ~/.local/share/sigrok-firmware/LA1010.bitstream
Tyrn commented 3 years ago

Thanks!!

It gets recognized right away. Tomorrow I'll try the sorry gadget.

AlexUg commented 3 years ago

I have updated the sources to support version 3.5.x. If you want, you can try.