[Bug 197773] [snd_hda][patch] Sending a devctl notifications when headphones are connected/disconnected

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Feb 17 23:41:51 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197773

            Bug ID: 197773
           Summary: [snd_hda][patch] Sending a devctl notifications when
                    headphones are connected/disconnected
           Product: Base System
           Version: 10.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: ebfe at inbox.ru

It would be nice to have devctl/devd notifications when headphones are
connected/disconnected.

E.g.,
cat /var/run/devd.pipe
!system=SND_HDA subsystem=headphones type=connection state=disconnected
!system=SND_HDA subsystem=headphones type=connection state=connected

So, with some devd.conf-magic one could easily preserve and restore mixer (or
hw.snd.default_unit) settings.

Maybe, something like this:
Index: /usr/src/sys/dev/sound/pci/hda/hdaa.c
===================================================================
*** /usr/src/sys/dev/sound/pci/hda/hdaa.c    (revision 278924)
--- /usr/src/sys/dev/sound/pci/hda/hdaa.c    (working copy)
***************
*** 381,394 ****
--- 381,397 ----
      struct hdaa_devinfo *devinfo = w->devinfo;
      struct hdaa_audio_as *as = &devinfo->as[w->bindas];
      struct hdaa_widget *w1;
      struct hdaa_audio_ctl *ctl;
      uint32_t val;
      int j, connected = w->wclass.pin.connected;

+     devctl_notify("SND_HDA", "headphones", "connection", 
+         connected ? "state=connected" : "state=disconnected");
+ 
      HDA_BOOTVERBOSE(
          device_printf((as->pdevinfo && as->pdevinfo->dev) ?
              as->pdevinfo->dev : devinfo->dev,
              "Redirect output to: %s\n",
              connected ? "headphones": "main");
      );
      /* (Un)Mute headphone pin. */

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list