Reinitialize on any error code, not just a negative one.
Upstream libg15 propagates any error code from libusb to the caller, and legacy libusb-0.1 uses standard codes from errno.h with minus sign resulting in negative integers. Previous version of reinit-on-any-error patch uses this fact and calls re_initLibG15() on any negative return value of getPressedKeys(). The new libusb-1.0 uses its own error codes, not compatible with the old ones. While rewriting libg15 to use the new library, I decided to translate LIBUSB_ERROR_* codes to G15_ERROR_*, which are positive integers. This change requires us to modify reinit-on-any-error patch to call re_initLibG15() on any error code, not just a negative one.
This commit is contained in:
1 parent
96591e26fa
commit
7d071c32b7
2 files changed
+11
-4
No files matched your search
Vendored
+6
@@ -1,3 +1,9 @@
|
|||||||
|
g15daemon (1.9.5.3-11) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Reinitialize on eny error code, not only on a negative one.
|
||||||
|
|
||||||
|
-- Alexander Ponyatykh <lazyranma@gmail.com> Sun, 17 Nov 2019 15:24:00 +0300
|
||||||
|
|
||||||
g15daemon (1.9.5.3-10) unstable; urgency=medium
|
g15daemon (1.9.5.3-10) unstable; urgency=medium
|
||||||
|
|
||||||
* Rebuild (no source changes).
|
* Rebuild (no source changes).
|
||||||
|
|||||||
+5
-4
@@ -7,16 +7,17 @@ Last-Update: 2015-05-18
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- a/g15daemon/main.c
|
--- a/g15daemon/main.c
|
||||||
+++ b/g15daemon/main.c
|
+++ b/g15daemon/main.c
|
||||||
@@ -204,10 +204,10 @@
|
@@ -203,11 +203,10 @@
|
||||||
|
g15daemon_send_event(masterlist->current->lcd,
|
||||||
G15_EVENT_KEYPRESS, keypresses);
|
G15_EVENT_KEYPRESS, keypresses);
|
||||||
lastkeys = keypresses;
|
lastkeys = keypresses;
|
||||||
|
-
|
||||||
- }else if(retval == -ENODEV && LIBG15_VERSION>=1200) {
|
- }else if(retval == -ENODEV && LIBG15_VERSION>=1200) {
|
||||||
+ }else if(retval < 0 && LIBG15_VERSION>=1200) {
|
+ }else if(retval != G15_NO_ERROR && retval != G15_ERROR_TIMEOUT && LIBG15_VERSION>=1200) {
|
||||||
|
+ g15daemon_log(LOG_WARNING,"Keyboard error (%d).. Reinitializing\n", retval);
|
||||||
pthread_mutex_lock(&g15lib_mutex);
|
pthread_mutex_lock(&g15lib_mutex);
|
||||||
while((retval=re_initLibG15() != G15_NO_ERROR) && !leaving){
|
while((retval=re_initLibG15() != G15_NO_ERROR) && !leaving){
|
||||||
- g15daemon_log(LOG_WARNING,"Keyboard has gone.. Retrying\n");
|
- g15daemon_log(LOG_WARNING,"Keyboard has gone.. Retrying\n");
|
||||||
+ g15daemon_log(LOG_WARNING,"Keyboard error (%d).. Reinitializing\n", retval);
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
if(!leaving) {
|
if(!leaving) {
|
||||||
Reference in new issue
Block a user