velum / lguf-brightness

Adjust brightness for LG UltraFine 4K display (cross platform)
49 stars 11 forks source link

error in ubuntu 18.10 (submiturb failed error -1 errno=16) #1

Closed patte closed 5 years ago

patte commented 5 years ago

Thank you very much for doing the linux porting work! Sadly it's not working for me. System: Ubuntu 18.10 - 4.18.0-10-generic The LG is connected via TB3.

screenshot from 2018-10-29 21-57-00 screenshot from 2018-10-29 21-56-38

dmesg:

[ 9226.839535] hid-generic 0003:043E:9A40.000D: hiddev1,hidraw2: USB HID v1.11 Device [LG Electronics Inc. USB Controls] on usb-0000:09:00.0-1.4.2/input0
[ 9232.039725] retire_capture_urb: 75 callbacks suppressed
...
[ 9523.319329] usb 3-1.4.2: usbfs: process 5109 (lguf_brightness) did not claim interface 1 before use
[ 9524.723430] usb 3-1.4.2: usbfs: process 5109 (lguf_brightness) did not claim interface 1 before use
javanna commented 5 years ago

I have exactly the same problem on Fedora 28

periklis commented 5 years ago

Here is the fix for now, i will open a PR

     if (openCode == 0)
     {
         libusb_set_auto_detach_kernel_driver(handle, 1);
-        r = libusb_claim_interface(handle, 0);
+        r = libusb_claim_interface(handle, 1);
         if (r != LIBUSB_SUCCESS) {
             printw("Failed to clain interface 0. Error: %d\n", r);
         }

         adjust_brighness(handle);
-        libusb_release_interface(handle, 0);
+        libusb_release_interface(handle, 1);
         libusb_close(handle);
     }
     else
velum commented 5 years ago

Hi all! Thank you Patte for reporting the problem, and thank you Periklis for finding a fix. I haven't touched that code in a while and when I re-opened my IDE to try the proposed fix, I realized that I already had a lot of uncommitted new code, and that that code also had a fix for this problem. It finds the proper interface using the vendor ID and the product ID. Please give it a try and let me know if it is working with 18.10. Sorry to have forgotten to commit that code.

periklis commented 5 years ago

@velum Master works as expected. Thanks for pushing the missing pieces. I will close my PR