Skip to content
Merged
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
82 changes: 71 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,86 @@ name: Qt CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-15]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install libusb
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install libusb-1.0-0-dev
- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v4
with:
modules: qtwebchannel qtpositioning qtserialport qt5compat qtwebengine
- uses: ilammy/msvc-dev-cmd@v1
- name: Build on ${{ matrix.os }}
shell: cmd
if: runner.os == 'Windows'
run: |
vcpkg install libusb
set PKG_CONFIG_PATH=C:/vcpkg/packages/libusb_x64-windows/lib/pkgconfig;%PKG_CONFIG_PATH%
md build
cd build
qmake ../qserial.pro
nmake
dir /s
del release\*.obj release\*.cpp
- name: Build on ${{ matrix.os }}
shell: bash
if: runner.os != 'Windows'
run: |
mkdir build
cd build
qmake ../qserial.pro
make -j$(nproc)

- name: Deploy (Windows)
if: matrix.os == 'windows-latest'
run: windeployqt build/release/QSerial.exe

- name: Deploy (macOS)
if: matrix.os == 'macos-15'
run: macdeployqt build/QSerial.app -dmg

- name: Deploy (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
# Example using linuxdeployqt or creating a simple tarball
ldd build/QSerial
#tar -czvf QSerial-Linux.tar.gz build/QSerial

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
modules: qtwebengine
- name: qmake
run: qmake qserial.pro
- name: make
run: make
name: qserial-${{ matrix.os }}
path: |
build/release
build/QSerial
build/*.dmg
if-no-files-found: error

release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 0 additions & 34 deletions .github/workflows/release.yml

This file was deleted.

24 changes: 16 additions & 8 deletions drivers/serialportcp210x.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "serialportcp210x.h"
#include <QDebug>
#include <QVector>
#include <QtGlobal>


#define CP210X_CTRL_IN \
(LIBUSB_RECIPIENT_INTERFACE | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN)
Expand Down Expand Up @@ -28,14 +30,20 @@

#define TIMEOUT 300

struct Q_PACKED SerialStatusResponse {
quint32 ulErrors;
quint32 ulHoldReasons;
quint32 ulAmountInInQueue;
quint32 ulAmountInOutQueue;
quint8 bEofReceived;
quint8 bWaitForImmediate;
quint8 bReserved;
#ifdef _MSC_VER
#define PACKED_STRUCT __declspec(align(1))
#else
#define PACKED_STRUCT __attribute__((packed))
#endif

struct PACKED_STRUCT SerialStatusResponse {
uint32_t ulErrors;
uint32_t ulHoldReasons;
uint32_t ulAmountInInQueue;
uint32_t ulAmountInOutQueue;
uint8_t bEofReceived;
uint8_t bWaitForImmediate;
uint8_t bReserved;
};

SerialPortCP210X::SerialPortCP210X(QObject *parent, libusb_device *device)
Expand Down