Linux(Ubuntu)
On Linux, the required dependencies can be installed via
sudo apt install -y libudev-dev libusb-1.0-0-dev libhidapi-libusb0
sudo apt install -y libjpeg-dev zlib1g-dev libopenjp2-7 libtiff5
sudo tee /etc/udev/rules.d/10-streamdeck.rules<< EOF
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0fd9", GROUP="users", TAG+="uaccess"
EOF
sudo udevadm control --reload-rules
And when compiling, you need to add -ljpeg -lpthread -lusb-1.0 -std=c++11 -lpng
and link the dynamic library
Before running, you also need to configure the dynamic library into the environment variable
Library version selection and download
Download address of zlib library and libpng library: https://jaist.dl.sourceforge.net/project/libpng/
The version of zlib library downloaded is: zlib-1.2.11
The version of libpng library downloaded is: libpng-1.6.37
Unzip the downloaded compressed package and enter the directory
tar -xf zlib-1.2.11.tar.gz && cd zlib-1.2.11
Run sudo ./configure to generate the makefile
sudo ./configure
Run make
sudo make
At last
sudo make install
The libpng library also performs the above operations
When using a dynamic library, you need to first define a DeviceManager
class object (device manager class), and then call the enumerate()
function to traverse the device to obtain a list of device objects.
DeviceManager *manager = new DeviceManager();
map<char *,streamDock *> StreamDocks = manager->enumerate();
After getting the device object list, you need to call the open()
method to open the device before calling other methods to operate the device.
auto it = StreamDocks->begin();
StreamDock *s = *it;
s->open();
s->setBrightness(100);