aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2020-03-07 11:31:12 +0100
committercbdev <cb@cbcdn.com>2020-03-07 11:31:12 +0100
commit413ff0c6eb83fc603f96f870769e50c6234bd171 (patch)
treea73b5b18c9755a4d6e72655e34e48547c186ac7a /backends
parentd72d7cc6366f901eb9503bac613e3bc280ac8fc5 (diff)
downloadmidimonster-413ff0c6eb83fc603f96f870769e50c6234bd171.tar.gz
midimonster-413ff0c6eb83fc603f96f870769e50c6234bd171.tar.bz2
midimonster-413ff0c6eb83fc603f96f870769e50c6234bd171.zip
Fix openpixelcontrol edge case
Diffstat (limited to 'backends')
-rw-r--r--backends/openpixelcontrol.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/backends/openpixelcontrol.c b/backends/openpixelcontrol.c
index d9d7d4b..b5885b0 100644
--- a/backends/openpixelcontrol.c
+++ b/backends/openpixelcontrol.c
@@ -1,4 +1,5 @@
#define BACKEND_NAME "openpixelcontrol"
+#define DEBUG
#include <string.h>
@@ -422,10 +423,9 @@ static ssize_t openpixel_client_pixeldata(instance* inst, openpixel_client* clie
//ignore data
if(client->buffer == -2){
//ignore data
- u = min(client->left, bytes_left);
- client->offset += u;
- client->left -= u;
- return u;
+ client->offset += bytes_left;
+ client->left -= bytes_left;
+ return bytes_left;
}
//handle broadcast data
else if(client->buffer == -3){
@@ -559,7 +559,7 @@ static int openpixel_client_handle(instance* inst, int fd){
}
else{
//read data
- bytes_handled = openpixel_client_pixeldata(inst, data->client + c, buffer + offset, bytes_left);
+ bytes_handled = openpixel_client_pixeldata(inst, data->client + c, buffer + offset, min(bytes_left, data->client[c].left));
if(bytes_handled < 0){
//FIXME handle errors
}