]> mj.ucw.cz Git - ursary.git/commitdiff
Detach kernel driver if needed
authorMartin Mares <mj@ucw.cz>
Sun, 14 Oct 2018 17:45:31 +0000 (19:45 +0200)
committerMartin Mares <mj@ucw.cz>
Sun, 14 Oct 2018 17:45:31 +0000 (19:45 +0200)
nocturn.c

index a313b4949c8f6bd757a4d28b99d3c40283e407ea..e4d0af6fefc1289db4222d1507c9f841075828df 100644 (file)
--- a/nocturn.c
+++ b/nocturn.c
@@ -394,6 +394,9 @@ static void noct_connect(struct main_timer *t)
   if ((err = libusb_open(found_dev, &usb_dev)) < 0)
     return noct_error(err, "libusb_open failed");
 
+  // In newer kernels, Nocturn is claimed by snd-usb-audio. Tell it to surrender the device.
+  libusb_detach_kernel_driver(usb_dev, 0);
+
   // There exist configurations 1 (high brightness) and 2 (power-save)
   if ((err = libusb_set_configuration(usb_dev, 2)) < 0)
     return noct_error(err, "libusb_set_configuration failed");