]> mj.ucw.cz Git - ursary.git/blobdiff - ursaryd.c
Generalized glue between LibUSB and LibUCW mainloop
[ursary.git] / ursaryd.c
index ca3f0617de0ccc693188f8970ccc98ad0d00ab49..8df65df31a8493eee81ea6cb22a0889c6e453ede 100644 (file)
--- a/ursaryd.c
+++ b/ursaryd.c
@@ -1,7 +1,7 @@
 /*
  *     The Ursary Audio Controls
  *
 /*
  *     The Ursary Audio Controls
  *
- *     (c) 2014--2018 Martin Mares <mj@ucw.cz>
+ *     (c) 2014--2020 Martin Mares <mj@ucw.cz>
  */
 
 #undef LOCAL_DEBUG
  */
 
 #undef LOCAL_DEBUG
 #include <syslog.h>
 
 #include "ursaryd.h"
 #include <syslog.h>
 
 #include "ursaryd.h"
+#include "usb.h"
 
 /*
  *     Map of all controls
  *
  *             rotary          red button      green button
 
 /*
  *     Map of all controls
  *
  *             rotary          red button      green button
- *     0       sink Brum       mute            -
+ *     0       sink PCH        mute            use headphones
  *     1       -               -               -
  *     2       -               -               -
  *     3       -               -               -
  *     1       -               -               -
  *     2       -               -               -
  *     3       -               -               -
- *     4       MPD             mute            play/pause/stop
- *     5       Albireo MPV     mute            -
- *     6       Albireo other   mute            -
- *     7       other machines  mute            -
+ *     4       MPD             mute            MPD play/pause
+ *     5       Albireo MPV     mute            MPD stop
+ *     6       Albireo other   mute            MPD prev
+ *     7       other machines  mute            MPD next
  *
  *     center  -
  *     slider  -
  */
 
  *
  *     center  -
  *     slider  -
  */
 
+#define PCH_SINK "alsa_output.pci-0000_00_1f.3.analog-stereo"
+
 /*** Sink controls ***/
 
 static double volume_from_pa(pa_volume_t vol)
 /*** Sink controls ***/
 
 static double volume_from_pa(pa_volume_t vol)
@@ -604,8 +607,8 @@ static void do_update(struct main_timer *t)
     }
 
   // Everything normal
     }
 
   // Everything normal
-  update_ring_from_sink(0, "alsa_output.brum.analog-stereo");
-  update_button_from_port(8, "alsa_output.brum.analog-stereo", "analog-output-headphones");
+  update_ring_from_sink(0, PCH_SINK);
+  update_button_from_port(8, PCH_SINK, "analog-output-headphones");
   update_groups();
 #if 0
   update_default_sink();
   update_groups();
 #if 0
   update_default_sink();
@@ -644,7 +647,7 @@ void notify_rotary(int rotary, int delta)
   switch (rotary)
     {
     case 0:
   switch (rotary)
     {
     case 0:
-      update_sink_from_rotary(delta, "alsa_output.brum.analog-stereo");
+      update_sink_from_rotary(delta, PCH_SINK);
       break;
     default:
       update_group_from_rotary(rotary, delta);
       break;
     default:
       update_group_from_rotary(rotary, delta);
@@ -659,10 +662,10 @@ void notify_button(int button, int on)
   switch (button)
     {
     case 0:
   switch (button)
     {
     case 0:
-      update_sink_mute_from_button(on, "alsa_output.brum.analog-stereo");
+      update_sink_mute_from_button(on, PCH_SINK);
       break;
     case 8:
       break;
     case 8:
-      update_port_from_button(on, "alsa_output.brum.analog-stereo", "analog-output-lineout", "analog-output-headphones");
+      update_port_from_button(on, PCH_SINK, "analog-output-lineout", "analog-output-headphones");
       break;
 #if 0
     case 9:
       break;
 #if 0
     case 9:
@@ -727,6 +730,7 @@ static void daemon_body(struct daemon_params *dp)
   main_init();
   update_timer.handler = do_update;
 
   main_init();
   update_timer.handler = do_update;
 
+  usb_init();
   noct_init();
   pulse_init();
   mpd_init();
   noct_init();
   pulse_init();
   mpd_init();