# Support for adjusting headphones volume on the headphones.

## rozyk

Hi.

I have headphones with a control of volume on the cable, but when I press the buttons nothing happens. Is there a particular driver I have to install in the kernel to support that? Or do I have to set some key event binding?

Thanks for you help  :Embarassed:  ,

rozyk

----------

## audiodef

Generally, such volume control has nothing to do with whatever the headphones are attached to. If it's not working, you should contact the headphone manufacturer.

----------

## rozyk

It's working when connected to other devices, it must be the case of handling some key event?

----------

## rozyk

@up

----------

## Logicien

You should check the mixer during you press the button to see if something move/appear with Alsamixer and Pulseaudio if you use both. A common problem can be that the input/output headphones volumes are lock/mute.

Even Aumix can help you if the headphones volumes depend on OSS compatiblity. The appropriate sound modules must be loaded, snd-pcm-oss and snd-mixer-oss.

If you have several headphone connectors you can use like line-in, line-out, headhpones and speakers, not all may work by default. You have to make a test with each of them with your headphones. Some tweaks may need to be done on Linux side to make all them work properly. Of course I think about a desktop computer.

----------

## rozyk

It's a laptop, does it make any difference?

```

CONFIG_ARCH_HIBERNATION_POSSIBLE=y

CONFIG_ARCH_SUSPEND_POSSIBLE=y

CONFIG_CROSS_COMPILE=""

CONFIG_CROSS_MEMORY_ATTACH=y

CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y

# CONFIG_CHR_DEV_OSST is not set

# CONFIG_TUN_VNET_CROSS_LE is not set

# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set

CONFIG_SSB_POSSIBLE=y

CONFIG_BCMA_POSSIBLE=y

CONFIG_SOUND_OSS_CORE=y

CONFIG_SOUND_OSS_CORE_PRECLAIM=y

CONFIG_SND_OSSEMUL=y

CONFIG_SND_MIXER_OSS=y

CONFIG_SND_PCM_OSS=y

CONFIG_SND_PCM_OSS_PLUGINS=y

CONFIG_SND_SEQUENCER_OSS=y

```

I checked with alsamixer and nothing is muted and nothing is changing when I press the buttons on the headphones.

----------

## Ant P.

Just to make sure: these are USB headphones and not some proprietary phone connector, right?

----------

## rozyk

Those are not USB headphones.

https://www.marshallheadphones.com/mh_es_en/major-ii-pitch-black

Those are the ones.

----------

## Logicien

When Alsamixer is open press the F6 button. It will show you the available mixers for every sound card. If your headsets appear, choose this sound card and look a the states of the channels. Headsets for USB are consider as separate sound card who have it's own mixer for volume.

I have Logitech wireless headsets in dual mode connection USB or Bluetooth. In USB mode, I cannot change the volume level from the headsets. I can only from Linux. In Bluetooth mode I can. I don't understand why, I need to search for this.

----------

## rozyk

But those are not usb headphones. They have mini jack.

Nothing particular appears there in alsamixer upon pressing F6.

----------

## Logicien

I found a solution for myself and I think it should work for a lot a USB headsets wire or wireless. It appear, thank's to my Google search, that the USB headsets buttons volumeup, volumedown, cdplay, cdprev and cdnext in my case are detected as ACPI events by Linux.

So, the acpid daemon must be up and running first. If the acpid actual configuration do not know what to do with a button event or do the wrong thing, it must be associate explicitely to an action that correspond or not to it function. If you start listenning to ACPI events in a terminal with the command

```
acpi_listen
```

and than press your up and down the volume buttons, the events should be detected and reported as button/volumeup and button/volumedown. So with these informations you can create an action like I did in the file /etc/acpi/events/volumeup

```
 

event=button/volumeup

action=amixer -c 0 set PCM 1+
```

and /etc/acpi/events/volumedown:

```
event=button/volumedown

action=amixer -c 0 set PCM 1-
```

Just be sure that the -c parameter value of amixer correspond to your USB sound card number as best reported by the command

```
aplay -l
```

You cant take any action you want for each event reported for any button of your headsets.

Than restart the acpid daemon. You should be able to increase and decrease your USB headsets volume with it's buttons. It work correctly with my

```
Bus 004 Device 003: ID 046d:0a29 Logitech, Inc. H600 [Wireless Headset]
```

I do not have any wire USB headsets to see if buttons are detected as ACPI events too.

----------

## rozyk

acpi_listen only detects the press of the microphone button, but doesn't detect the press of the volume up/down. (there are three buttons, microphone, volume up, volume down)

```
acpi_listen 

jack/microphone MICROPHONE unplug

jack/microphone MICROPHONE plug

jack/microphone MICROPHONE unplug

jack/microphone MICROPHONE plug

jack/microphone MICROPHONE unplug

jack/microphone MICROPHONE plug

jack/microphone MICROPHONE unplug

jack/microphone MICROPHONE plug
```

https://sourceforge.net/p/ibm-acpi/mailman/message/28430708/

Can this be related? I also have level unsupported.

----------

## Logicien

If you have a Thinkpad, the package tpb may help you. You can configure the Thinkpad integrated buttons with it.

You need to configure Gentoo for the Thinkpad first than, with the appropriate kernel support, maybe the headsets buttons will be detected as ACPI events. I cannot say more for the moment. On my side, of six buttons, only the microphone mute is not detected as an ACPI event, but it work as it should. All others I have are now correctly configure to be use properly. 

The fact that those buttons where not usable was boring me since I had the Logitech headsets. Thank's to your thread, I am happy to have found a solution that may apply to a lot of USB headsets. You need to make searches as I did. 

 :Smile: 

----------

## rozyk

tpb didn't help.  :Sad: 

----------

## rozyk

@up

----------

## albright

you could try 

```
xbindkeys -k 
```

to see if xbindkeys see the

key presses ... (on my thinkpad some key presses that

acpi listen does not see, are seen by xbindkeys). If

xbindkeys registers the presses you can then assign

vol up or down scripts

----------

## Logicien

Thank's albright for this answer. I haven't think to use xbindkeys. It detect some of my buttons. However, xev detect all the buttons except the microphone mute button like acpi_listen.

So, xev can be use too to know the keycode of a button and the keysym associated with it. Than you can use xmodmap to associate the appropriate keysym to the keycode if needed. In final, with Xfce4 I can associate a command to execute for each keysym of my headsets buttons in Menu Xfce4/Parameters/Keyboard/Application shortcuts.

----------

## rozyk

Thanks guys for your answers.

Unfortunately, it didn't help. I've tried each of the three: acpi_listen, xev, xbindkeys.

xbindkeys and xev didn't detect anything (no volume up/down, no microphone mute/unmute)

acpit_listen detects only microphone mute/unmute.

None of the tools detects volume  :Sad: 

Do you have any other ideas?  :Crying or Very sad: 

----------

## Logicien

Is the acpid daemon up and running? One of the last tries for me is to watch the Linux kernel messages during pressing the buttons.

```
watch -d -n 2 'dmesg | tail'
```

I would prefer to do this one at the console and not in X.

Try all the tests you have done so far with a binary distribution, in live can be enough. An other kernel configuration can give other results.

I am sorry to tell you this, try other USB headsets.

----------

