I am using Linux (2.6.39 kernel) and trying to find a way that would allow me to send volume increment/decrement commands from my host Linux OS to the Jabra device. I saw this functionality is possible both in Windows and Ubuntu, where controlling of the volume from the PC alters the Jabra volume.
I am able to accept Consumer HID volume increment/decrement commands from the Jabra to the host OS, but not the other way around. Also, I can send Mute or Off-Hook commands to the Jabra, using the HIDIOCSUSAGE ioctl, but I couldn't find the corresponding usage id for the volume controls in the official USB usage table document.
I am not sure if volume commands from the host are indeed sent via the HID or some other API such as the snd-usb-audio kernel module.
I would appreciate your insights.
Find out the name and the valid range of that mixer control, then just execute:
system("amixer cset name='Master Playback Volume' 42");
or access the control directly like this:
#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
static void check(int err, const char *f)
{
if (err < 0) {
fprintf(stderr, "%s failed: %s\n", f, snd_strerror(err));
exit(EXIT_FAILURE);
}
}
#define CHECK(f) check(f, #f)
int main()
{
snd_ctl_t *ctl;
snd_ctl_elem_value_t *value;
CHECK(snd_ctl_open(&ctl, "hw:1", 0)); // card number
snd_ctl_elem_value_alloca(&value);
snd_ctl_elem_value_set_interface(value, SND_CTL_ELEM_IFACE_MIXER);
snd_ctl_elem_value_set_name(value, "Master Playback Volume");
snd_ctl_elem_value_set_integer(value, 0, 42);
CHECK(snd_ctl_elem_write(ctl, value));
snd_ctl_close(ctl);
return 0;
}