Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Linux install description and script #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,68 @@ WeAct LogicAnalyzerV1 is a logic analyzer designed based on Cypress `CY7C68013A`
* Communication mode: USB 2.0 (In order to ensure the sampling rate of 24Mhz, try not to use USB docking station)

# Begin to use

## Windows

1. Download [sigrok-PulseView Software](https://sigrok.org/wiki/Downloads) (Be sure to download the Release builds,0.4.2 Version)
2. Install sigrok-PulseView && LogicAnalyzer driver
> After PulseView is installed, run Zadig, select the device you want to Install the Driver on, check Edit, change the device name to `fx2LAFw`, and then click `Install Driver`
![](./Images/WeAct-LogicAnalyzerV1-02.png)
3. Click PulseView to run the software, and the yellow light of the logic analyzer will light up,indicating that the firmware is loaded successfully and the logic signal can be sampled

## Linux

### Install Sigrok-PulseView Software

#### Debian/Ubuntu
```shell
apt get install pulseview

```

#### Arch
```shell
pacman -S pulseview

```

### Install Sigrok FX2 firmware

The firmware files are required as the FX2 controller does not hold the firmware. Sigrok loads it via USB before using the device.

The firmware might be available in your distributions package repository.

Alternativly you can use the `setup_linux.sh` script from the `\Tools` folder.

#### Debian/Ubuntu
```shell
apt get install sigrok-firmware-fx2lafw sigrok-cli

```

#### Arch
```shell
pacman -S sigrok-firmware-fx2lafw sigrok-cli

```

In order to check if the firmware was installed correctly, you can use `sigrok-cli`:

```shell
> sigrock-cli --scan
The following devices were found:
demo - Demo device with 13 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 A3 A4
fx2lafw - sigrok FX2 LA (8ch) with 8 channels: D0 D1 D2 D3 D4 D5 D6 D7

```


### Check and install udev rules if required

Run `setup_linux.sh` from `\Tools` folder in this repo.

Alternatively download udev files from [libsigrok repository](https://github.com/sigrokproject/libsigrok/tree/master/contrib) and copy them to `/etc/udev/rules.d/`.

# Supported protocols
See sigrok [Supported Protocol decoders](https://sigrok.org/wiki/Protocol_decoders)

Expand Down
76 changes: 76 additions & 0 deletions Tools/setup_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/usr/bin/env bash

# check if udev rules for sigrok are installed, download and install if not present

declare -A udev_files_and_urls=(
["/etc/udev/rules.d/60-libsigrok.rules"]="https://raw.githubusercontent.com/sigrokproject/libsigrok/refs/heads/master/contrib/60-libsigrok.rules"
["/etc/udev/rules.d/61-libsigrok-plugdev.rules"]="https://raw.githubusercontent.com/sigrokproject/libsigrok/refs/heads/master/contrib/61-libsigrok-plugdev.rules"
["/etc/udev/rules.d/61-libsigrok-uaccess.rules"]="https://raw.githubusercontent.com/sigrokproject/libsigrok/refs/heads/master/contrib/61-libsigrok-uaccess.rules"
)

RELOAD_RULES_REQUIRED=false
echo "Checking udev rules..."
for file in "${!udev_files_and_urls[@]}"; do
if [ ! -e "$file" ]; then
echo "udev file does not exist: $file"
echo -n "downloading from ${udev_files_and_urls[$file]}..."
sudo wget -q -O "$file" "${udev_files_and_urls[$file]}"
if [ $? -eq 0 ]; then
RELOAD_RULES_REQUIRED=true
echo "done."
else
echo "failed."
fi
fi
done

if [ "$RELOAD_RULES_REQUIRED" = true ]; then
echo -n "Applying new udev rules..."
sudo udevadm control --reload-rules
sudo udevadm trigger
echo "done."
else
echo "done. Nothing to do."
fi

# check if firmware file is present and download if not
# Required as FX2 controller does not store the firmware but loads it every time it boots.
FW_FILE="fx2lafw-sigrok-fx2-8ch.fw"
FW_LOCATIONS=(
"/usr/share/sigrok-firmware/"
"$HOME/.local/share/sigrok-firmware/"
"$HOME/.local/share/flatpak/exports/share/sigrok-firmware/"
"/var/lib/flatpak/exports/share/sigrok-firmware/"
"/usr/local/share/sigrok-firmware/"
"/var/lib/snapd/desktop/sigrok-firmware/"
)
FW_DEF_INSTALL="$HOME/.local/share/sigrok-firmware/"
FW_ARCHIVE="sigrok-firmware-fx2lafw-bin-0.1.7.tar.gz"
FW_ARCHIVE_URL="https://sigrok.org/download/binary/sigrok-firmware-fx2lafw/"

echo "Checking if firmware file is present"
FW_FOUND=false
for FW_LOCATION in ${FW_LOCATIONS[@]}; do
if [ -e "${FW_LOCATION}$FW_FILE" ]; then
FW_FOUND=true
fi
done
if [ "$FW_FOUND" = true ]; then
echo "Firmware found. Nothing to do."
else
echo "Firmware not found. Downloading to $FW_DEF_INSTALL"
pushd /tmp > /dev/null
mkdir sigrok-fw
cd sigrok-fw
wget -q -O "$FW_ARCHIVE" "${FW_ARCHIVE_URL}${FW_ARCHIVE}"
tar -xf "${FW_ARCHIVE}" --strip-components 1
if [ -e "$FW_FILE" ]; then
cp "$FW_FILE" "$FW_DEF_INSTALL"
else
echo "Error getting firmware. Please download firmware and copy files manually to $FW_DEF_INSTALL."
fi
cd ..
rm -R sigrok-fw
popd >/dev/null
fi