LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-09-2021, 08:29 PM   #1
mathwhiz
LQ Newbie
 
Registered: Nov 2018
Posts: 26

Rep: Reputation: Disabled
Is it possible to use the Dell AC511 volume knob under Slackware?


My Dell AC511 speaker has a volume knob. I have been looking in to
whether it can be made usable under Slackware. With pulseausio running,
the output from
pacmd list-sources >t1
includes the following.
* index: 1
name: <alsa_input.usb-Dell_Dell_AC511_USB_SoundBar-00.analog-stereo>
driver: <module-alsa-card.c>
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAM
IC_LATENCY
state: SUSPENDED
suspend cause: IDLE
and later
alsa.driver_name = "snd_usb_audio"

I issued
parecord\
--device="alsa_input.usb-Dell_Dell_AC511_USB_SoundBar-00.analog-stereo"\
--raw parecord.dat
twice, and let it run for ~5 seconds, the first time without turning the
knob, and the second with turning it. Both time the result was ~1M of 0's.

Question 1: Is this the knob device?
Question 2: Is there a driver for this device?
Question 3: Why isn't there any data?
Question 4: What is the format of a volume knob data stream?

Some further information.
lsmod lists snd_usb_audio.
PA_SOURCE_HW_VOLUME_CTRL is defined in /usr/include/pulse/def.h
 
Old 09-10-2021, 06:39 AM   #2
SavoTU
Member
 
Registered: Apr 2005
Distribution: Slackware64 Current
Posts: 199

Rep: Reputation: 40
The simplest way I have found to get my remote working after someone removed the code i needed for ir-keytable is was with evemu https://slackbuilds.org/repository/1...lopment/evemu/

After install run
Code:
evemu-describe
If your speaker is listed ctrl c out and run
Code:
evtest /dev/input/event[YOUR EVENT]
Then try the volume control both ways, if you get a keypress we can work with it.
 
Old 09-10-2021, 08:33 AM   #3
mathwhiz
LQ Newbie
 
Registered: Nov 2018
Posts: 26

Original Poster
Rep: Reputation: Disabled
won't record event

From event-describe, choose soundbar:
# Event type 1 (EV_KEY)
# Event code 113 (KEY_MUTE)
# Event code 114 (KEY_VOLUMEDOWN)
# Event code 115 (KEY_VOLUMEUP)

evemu-record /dev/input/event115 e115cl.dat
error: could not open device (No such file or directory)

cd /dev/event
ls
eventX for X from 0 to 12 are there
 
Old 09-10-2021, 09:25 AM   #4
SavoTU
Member
 
Registered: Apr 2005
Distribution: Slackware64 Current
Posts: 199

Rep: Reputation: 40
can you copy and paste the output from evemu-describe and evtest.
 
Old 09-10-2021, 04:07 PM   #5
mathwhiz
LQ Newbie
 
Registered: Nov 2018
Posts: 26

Original Poster
Rep: Reputation: Disabled
I'm still doing research, but here's some additional information.

evtest is not in evemu; you can get it from
https://gitlab.freedesktop.org/libevdev/evtest

https://stackoverflow.com/questions/6990978/
how-can-i-know-which-of-the-dev-input-eventx-x-0-7-have-the-linux-input-stre
has useful information. E.g., cat /proc/bus/input/devices
produces as one item:

I: Bus=0003 Vendor=413c Product=a503 Version=0100
N: Name="Dell Dell AC511 USB SoundBar"
P: Phys=usb-0000:00:14.0-4/input3
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.3/0003:413C:A503.0001/i
nput/input13
U: Uniq=
H: Handlers=kbd event10
B: PROP=0
B: EV=13
B: KEY=e0000 0 0 0
B: MSC=10

I'm going to play around with evtest and I'll post any further information.
I'm also going to read
https://www.kernel.org/doc/html/late...ent-codes.html
 
Old 09-10-2021, 10:34 PM   #6
mathwhiz
LQ Newbie
 
Registered: Nov 2018
Posts: 26

Original Poster
Rep: Reputation: Disabled
I got evtest working to monitor the volume knob. This answers my original
questions, but raises new ones:
Question 5. Is there a client that processes these events?
Question 6. If not, how do I write one?

Some details of the evtest run are as follows.
An easy way to determine the event number, at least in this case, is:
ls -l /dev/input/by_id
The output includes
usb-Dell_Dell_AC511_USB_SoundBar-event-if03 -> ../event10
Issuing
evtest /dev/input/event10 >evtest_10.txt
produced a file containing
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x413c product 0xa503 version 0x100
Input device name: "Dell Dell AC511 USB SoundBar"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 113 (KEY_MUTE)
Event code 114 (KEY_VOLUMEDOWN)
Event code 115 (KEY_VOLUMEUP)
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Then for clockwise turning of the knob some event 6-tuples
Event: time 1631328591.666299, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00e9
Event: time 1631328591.666299, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 1631328591.666299, -------------- SYN_REPORT ------------
Event: time 1631328591.682284, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00e9
Event: time 1631328591.682284, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 1631328591.682284, -------------- SYN_REPORT ------------
Then for counter-clockwise turning of the knob some event 6-tuples
Event: time 1631328593.890272, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00ea
Event: time 1631328593.890272, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 1
Event: time 1631328593.890272, -------------- SYN_REPORT ------------
Event: time 1631328593.906276, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00ea
Event: time 1631328593.906276, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 0
Event: time 1631328593.906276, -------------- SYN_REPORT ------------
 
Old 09-11-2021, 11:04 AM   #7
SavoTU
Member
 
Registered: Apr 2005
Distribution: Slackware64 Current
Posts: 199

Rep: Reputation: 40
Sorry its been a while I was assuming they was from the same package. I opted use them as they show keycodes that are above 255 so would have helped if the code was incorrect.

From a quick google it looks like client is the volume widget. Do you have one on your taskbar? If not try adding one.
 
Old 09-11-2021, 02:49 PM   #8
mathwhiz
LQ Newbie
 
Registered: Nov 2018
Posts: 26

Original Poster
Rep: Reputation: Disabled
I use xterm's and don't have a volume widget. I think these (e.g. alsamixer)
use controls (e.g. sliders) in the window and don't monitor the volume knob.
I have been using amixer from the command line. This works fine, except
if you try to adjust the volume while audacious is playing an internet
radio station audacious starts reporting errors and quits.

https://www.kernel.org/doc/html/latest/input/input.html
states the following:

USB uses HID also for monitor controls, speaker controls, UPSs, LCDs and many
other purposes. The monitor and speaker controls should be easy to add to
the hid/input interface

So it's surprising that no one seems to use this feature.
From what I've read you might be able to write a simple app using the
volume knob, using unix open, read, write, ioctl, etc. If I succeed in
doing this I'll post it. An app that goes through ALSA might be better.
Meanwhile I guess the thread should be marked "solved".
 
Old 09-11-2021, 03:56 PM   #9
SavoTU
Member
 
Registered: Apr 2005
Distribution: Slackware64 Current
Posts: 199

Rep: Reputation: 40
I use a script to start/stop my media player which among other things mutes/de-mutes using pamixer https://github.com/cdemoulins/pamixer (part of a full install).

Code:
pamixer -m
pamixer -u
pamixer --set-volume 100
pamixer -i [ --increase ] arg increase the volume
pamixer -d [ --decrease ] arg decrease the volume
I got the information about the volume widget from https://unix.stackexchange.com/quest...e-keys-in-xfce which also list some commands you can set as shortcuts which may be an option.

Code:
amixer -D pulse set Master 5%+     --> (Volume Up)
amixer -D pulse set Master 5%-     --> (Volume Down)
amixer -D pulse set Master toggle  --> (Mute/Unmute)
I have no idea how to set custom keybindings under xterm so good luck with that.
 
Old 09-11-2021, 04:25 PM   #10
SavoTU
Member
 
Registered: Apr 2005
Distribution: Slackware64 Current
Posts: 199

Rep: Reputation: 40
Well I have to admit this got me curious so i did a little more playing in /var/log/messages I have root: ACPI action volumedown is not defined so a quick look into that and its possible to set them in /etc/acpi/acpi_handler.sh

Gazl has described how he sets it up here https://www.linuxquestions.org/quest...ns-4175624572/

If you can it maybe better to rename this thread to better reflect the issue now we know the buttons work.
 
Old 09-11-2021, 07:01 PM   #11
mathwhiz
LQ Newbie
 
Registered: Nov 2018
Posts: 26

Original Poster
Rep: Reputation: Disabled
Here's a reference for xterm bindings.
https://utcc.utoronto.ca/~cks/space/...termKeybinding

If you run xev, put the pointer in the window, and turn the knob
you get some events as follows:

KeyPress event, serial 40, synthetic NO, window 0x2800001,
root 0xd6, subw 0x0, time 35197727, (102,137), root143,232),
state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
 
Old 09-15-2021, 11:01 AM   #12
mathwhiz
LQ Newbie
 
Registered: Nov 2018
Posts: 26

Original Poster
Rep: Reputation: Disabled
problem with C program

I've run in to a problem while trying to get a C volume knob monitor running.
Once I detect a knob event, I call adj_vol(c), with c=+1 for up,
c=-1 for down. Here is the code in its present state.

/*This was swiped from
https://stackoverflow.com/questions/6787318/
set-alsa-master-volume-from-c-code
*/
static void adj_vol(int c)
{
snd_mixer_t *mix_h;
snd_mixer_selem_id_t *sid;
const char *card = "default";
const char *selem_name = "Master";
snd_mixer_elem_t* elem;

/*open an empty mixer handle*/
if (snd_mixer_open(&mix_h, 0)<0) goto erxit;
/*attach the card to it*/
if (snd_mixer_attach(mix_h, card)<0) goto erxit;
/*register it*/
if (snd_mixer_selem_register(mix_h, NULL, NULL)<0) goto erxit;
/*load its elements*/
if (snd_mixer_load(mix_h)<0) goto erxit;

/*allocate an element ID (on the stack)*/
snd_mixer_selem_id_alloca(&sid);
/*set its index part*/
snd_mixer_selem_id_set_index(sid, 0);
/*set its name part*/
snd_mixer_selem_id_set_name(sid, selem_name);
/*find the element*/
if ((elem=snd_mixer_find_selem(mix_h, sid))<0) goto erxit;

{long lv,rv;
if (snd_mixer_selem_get_playback_volume(elem,SND_MIXER_SCHN_FRONT_LEFT,&lv)
<0) goto erxit;
/*DEBUG*/ printf("L=%li\n",lv);
if (snd_mixer_selem_get_playback_volume(elem,SND_MIXER_SCHN_FRONT_RIGHT,&rv)
<0) goto erxit;
/*DEBUG*/ printf("R=%li\n",rv);
}

snd_mixer_close(mix_h);
return;
erxit:
...
}

When I run this, it doesn't report any error, but prints incorrect
values for the volume levels. In one run, it printed
L=30129
R=30129
"amixer get Master" prints
Simple mixer control 'Master',0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right
Limits: Playback 0 - 65536
Mono:
Front Left: Playback 18535 [28%] [on]
Front Right: Playback 18535 [28%] [on]

I've traced through the axmixer code, even run it under gdb, and it
seems to be doing what my program does. I ran amixer under gdb
with the invocation "amixer set Master 3%+", and set a breakpoint at
line 368 of amixer.c (of the slackware 14.2 version of alsa-utils).
Stepping through the call, the value of "orig" is 18535.

I'm wondering whether this is a pulseaudio issue. After a fresh system
startup, pulseaudio is not running. Turning the knob with my program
running starts it.

pactl list sinks shows
Sink #0
State: SUSPENDED
Name: alsa_output.usb-Dell_Dell_AC511_USB_SoundBar-00.analog-stereo
Description: Dell AC511 USB SoundBar Analog Stereo
Driver: module-alsa-card.c
Sample Specification: s16le 2ch 44100Hz
Channel Map: front-left,front-right
Owner Module: 6
Mute: no
Volume: front-left: 18535 / 28% / -32.91 dB, front-right: 18535 / 28% / -32.91 dB
balance 0.00
Base Volume: 107931 / 165% / 13.00 dB
Monitor Source: alsa_output.usb-Dell_Dell_AC511_USB_SoundBar-00.analog-stereo.monitor
Latency: 0 usec, configured 0 usec
Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY
...
 
Old 09-15-2021, 12:31 PM   #13
marco70
Member
 
Registered: Sep 2009
Distribution: Slackware
Posts: 103

Rep: Reputation: 40
I have such a speaker, the knob works properly.
Slackware-current, kde, pulseaudio.

Code:
1. odpływ
        Stan: RUNNING
        Nazwa: alsa_output.usb-Dell_Dell_AC511_USB_SoundBar-00.analog-stereo
        Opis: Dell AC511 USB SoundBar Analogowe stereo
        Sterownik: module-alsa-card.c
        Określenie próbki: s16le 2 k 44100 Hz
        Mapa kanałów: front-left,front-right
        Właściciel modułu: 8
        Wyciszenie: nie
        Poziom głośności: front-left: 6554 /  10%,   front-right: 6554 /  10%
                          balans 0,00
        Głośność podstawowa: 65536 / 100%
        Źródło monitora: alsa_output.usb-Dell_Dell_AC511_USB_SoundBar-00.analog-stereo.monitor
        Opóźnienie: 280397 us, skonfigurowano 460000 us
        Flagi: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL LATENCY 
        Właściwości:
                alsa.resolution_bits = "16"
                device.api = "alsa"
                device.class = "sound"
                alsa.class = "generic"
                alsa.subclass = "generic-mix"
                alsa.name = "USB Audio"
                alsa.id = "USB Audio"
                alsa.subdevice = "0"
                alsa.subdevice_name = "subdevice #0"
                alsa.device = "0"
                alsa.card = "3"
                alsa.card_name = "Dell AC511 USB SoundBar"
                alsa.long_card_name = "Dell Dell AC511 USB SoundBar at usb-0000:00:14.0-9, full speed"
                alsa.driver_name = "snd_usb_audio"
                device.bus_path = "pci-0000:00:14.0-usb-0:9:1.0"
                sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9:1.0/sound/card3"
                udev.id = "usb-Dell_Dell_AC511_USB_SoundBar-00"
                device.bus = "usb"
                device.vendor.id = "413c"
                device.vendor.name = "Dell Computer Corp."
                device.product.id = "a503"
                device.product.name = "Dell AC511 USB SoundBar"
                device.serial = "Dell_Dell_AC511_USB_SoundBar"
                device.string = "front:3"
                device.buffering.buffer_size = "352800"
                device.buffering.fragment_size = "176400"
                device.access_mode = "mmap+timer"
                device.profile.name = "analog-stereo"
                device.profile.description = "Analogowe stereo"
                device.description = "Dell AC511 USB SoundBar Analogowe stereo"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-usb"
        Porty:
                analog-output: Analog Output (typ: Analogowe, priorytet: 9900, dostępność jest nieznana)
        Aktywny port: analog-output
        Formaty:
                pcm

Last edited by marco70; 09-15-2021 at 12:40 PM.
 
Old 09-15-2021, 01:14 PM   #14
mathwhiz
LQ Newbie
 
Registered: Nov 2018
Posts: 26

Original Poster
Rep: Reputation: Disabled
This might be because KDE has a process monitoring the knob. I found one relevant post:
https://askubuntu.com/questions/1211...et-how-to-load
I don't use KDE, and would like to get a simple light-weight monitor working.
 
Old 09-15-2021, 01:41 PM   #15
marco70
Member
 
Registered: Sep 2009
Distribution: Slackware
Posts: 103

Rep: Reputation: 40
I think that lxqt will start.

https://github.com/lxqt

There is a module pavucontrol-qt version 0.17.0 is already available

I used to have lxqt but not tested.

https://github.com/marco70-ms/slackb...tree/main/lxqt

Last edited by marco70; 09-15-2021 at 01:49 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Volume knob rapid press/release problem hirochiamaru Linux - Newbie 3 10-20-2007 08:04 AM
Keyboard volume knob configuration-cannot change volume. Ariox Ubuntu 1 03-22-2007 02:06 PM
Disable volume knob/whell on Laptop Biggen Linux - Laptop and Netbook 2 03-15-2007 04:17 PM
Trackpad taps to click easily on Dell laptop with SuSE; Knob-mouse does not function binarybase Linux - Newbie 4 08-07-2005 04:55 PM
Creative Sound Blaster Audigy2 Platinum: volume knob not working lopette Linux - Hardware 0 09-10-2004 05:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration