USB audio on riscv64
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CAJZ5D0bnMA=zZPztvQB4h0sXhU2og9D84QH8CXx5-GRWeu+4Ug@mail.gmail.com
Quoted 2 lines · Dmitri Seletski
I am just a user.
Can't help but wonder if usb snd modules were compiled in or loaded?
Hey Dmitri,
CC'ing the lists. When I plug in the device, I see the following on the bus:
$ lsusb ... Bus 001 Device 003: ID 1908:2070 GEMBIRD Honk HK-5002 USB Speaker ...
The kernel logs the following in kern.log:
[ 291.681086] usb 1-2.3: new full-speed USB device number 3 using xhci_hcd [ 291.850299] usb 1-2.3: New USB device found, idVendor=1908, idProduct=2070, bcdDevice= 1.00 [ 291.850333] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 291.850345] usb 1-2.3: Product: USB2.0 Device [ 291.850355] usb 1-2.3: Manufacturer: Generic [ 291.850365] usb 1-2.3: SerialNumber: 20130100ph0 [ 292.434209] mc: Linux media interface: v0.10 [ 292.734949] usb 1-2.3: 1:1: cannot get freq at ep 0x2 [ 292.802612] usb 1-2.3: 2:0: bogus dB values (-12800/-12700), disabling dB reporting [ 292.803733] usbcore: registered new interface driver snd-usb-audio
The device still doesn't appear to be visible to ALSA:
$ aplay -l aplay: device_list:276: no soundcards found...
If I try playing an Ogg/Vorbis file with mpv, I see the following with no sound:
$ mpv "/usr/share/games/lincity-ng/music/default/01 - pronobozo - lincity.ogg"
(+) Audio --aid=1 (vorbis 2ch 44100Hz)
AO: [pulse] 44100Hz stereo 2ch floatA: 00:01:00 / 00:03:30 (28%)
The device works fine on arm64 via a Raspberry Pi 4.
Signature · 3 lines
Kip Warner -- Senior Software Engineer OpenPGP signed/encrypted mail preferred https://www.thevertigo.com
Quoted 28 lines · Kip Warner
Quoted 2 lines · Dmitri Seletski
I am just a user.
Can't help but wonder if usb snd modules were compiled in or loaded?Hey Dmitri,
CC'ing the lists. When I plug in the device, I see the following on the bus:
$ lsusb ... Bus 001 Device 003: ID 1908:2070 GEMBIRD Honk HK-5002 USB Speaker ...The kernel logs the following in kern.log:
[ 291.681086] usb 1-2.3: new full-speed USB device number 3 using xhci_hcd [ 291.850299] usb 1-2.3: New USB device found, idVendor=1908, idProduct=2070, bcdDevice= 1.00 [ 291.850333] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 291.850345] usb 1-2.3: Product: USB2.0 Device [ 291.850355] usb 1-2.3: Manufacturer: Generic [ 291.850365] usb 1-2.3: SerialNumber: 20130100ph0 [ 292.434209] mc: Linux media interface: v0.10 [ 292.734949] usb 1-2.3: 1:1: cannot get freq at ep 0x2 [ 292.802612] usb 1-2.3: 2:0: bogus dB values (-12800/-12700), disabling dB reporting [ 292.803733] usbcore: registered new interface driver snd-usb-audio
Quoted 4 lines
The device still doesn't appear to be visible to ALSA:
$ aplay -l aplay: device_list:276: no soundcards found...
Check the contents in /proc/asound/cards. Is that empty as well?
If the card is recognized there, check the /sys/class/sound/*. If a PCM device is found there, it must be the lack of the corresponding device in /dev/snd/* that is usually created via udev.
Takashi
Quoted 1 line · Takashi Iwai
Check the contents in /proc/asound/cards. Is that empty as well?
Thanks for getting back to me, Takashi. Looks like it's empty:
$ sudo tree /proc/asound/ /proc/asound/ ├── Device -> card1 ├── card1 │ ├── id │ ├── pcm0p │ │ ├── info │ │ └── sub0 │ │ ├── hw_params │ │ ├── info │ │ ├── status │ │ └── sw_params │ ├── stream0 │ ├── usbbus │ ├── usbid │ └── usbmixer ├── cards ├── devices ├── hwdep ├── modules ├── oss │ ├── devices │ └── sndstat ├── pcm ├── seq │ ├── clients │ ├── drivers │ ├── queues │ └── timer ├── timers └── version
6 directories, 23 files
Quoted 1 line
If the card is recognized there, check the
/sys/class/sound/*.
This is what I see in that directory:
$ sudo tree /sys/class/sound/ /sys/class/sound/ ├── card1 -> ../../devices/platform/soc/e00000000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/0000:02:02.0/0000:04:00.0/usb1/1-2/1-2.1/1-2.1:1.0/sound/card1 ├── controlC1 -> ../../devices/platform/soc/e00000000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/0000:02:02.0/0000:04:00.0/usb1/1-2/1-2.1/1-2.1:1.0/sound/card1/controlC1 ├── pcmC1D0p -> ../../devices/platform/soc/e00000000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/0000:02:02.0/0000:04:00.0/usb1/1-2/1-2.1/1-2.1:1.0/sound/card1/pcmC1D0p ├── seq -> ../../devices/virtual/sound/seq └── timer -> ../../devices/virtual/sound/timer
5 directories, 0 files
Quoted 2 lines
If a PCM device is found there, it must be the lack of the corresponding device in
/dev/snd/*that is usually created via udev.
And this is what I see there:
$ sudo tree /dev/snd/ /dev/snd/ ├── by-id │ └── usb-Generic_USB2.0_Device_20130100ph0-00 -> ../controlC1 ├── by-path │ └── platform-e00000000.pcie-pci-0000:04:00.0-usb-0:2.1:1.0 -> ../controlC1 ├── controlC1 ├── pcmC1D0p ├── seq └── timer
2 directories, 6 files
A bit of information on my system:
$ uname -a Linux kip-unmatched 5.11.0-1021-generic #22-Ubuntu SMP Tue Sep 28 15:19:16 UTC 2021 riscv64 riscv64 riscv64 GNU/Linux
$ lscpu Architecture: riscv64 Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 4 Core(s) per socket: 1 Socket(s): 1 L1d cache: 32 KiB L1i cache: 32 KiB L2 cache: 2 MiB
I've also attached the output of the alsa-info(1) generated log.
Signature · 3 lines
Kip Warner -- Senior Software Engineer OpenPGP signed/encrypted mail preferred https://www.thevertigo.com
upload=true&script=true&cardinfo=
!!################################
!!ALSA Information Script v 0.4.65
!!################################
!!Script ran on: Fri Nov 5 18:44:49 UTC 2021
!!Linux Distribution
!!------------------
Ubuntu 21.04 \n \l DISTRIB_ID=Ubuntu DISTRIB_DESCRIPTION="Ubuntu 21.04" NAME="Ubuntu" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 21.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=hirsute Ubuntu 21.04 (Hirsute Hippo)
!!DMI Information
!!---------------
Manufacturer:
Product Name:
Product Version:
Firmware Version:
System SKU:
Board Vendor:
Board Name:
!!ACPI Device Status Information
!!---------------
!!Kernel Information
!!------------------
Kernel release: 5.11.0-1021-generic Operating System: GNU/Linux Architecture: riscv64 Processor: riscv64 SMP Enabled: Yes
!!ALSA Version
!!------------
Driver version: k5.11.0-1021-generic Library version: 1.2.4 Utilities version: 1.2.4
!!Loaded ALSA modules
!!-------------------
snd_usb_audio
!!Sound Servers on this system
!!----------------------------
Pulseaudio:
Installed - Yes (/usr/bin/pulseaudio)
Running - Yes
!!Soundcards recognised by ALSA
!!-----------------------------
1 [Device ]: USB-Audio - USB2.0 Device
Generic USB2.0 Device at usb-0000:04:00.0-2.1, full speed
!!PCI Soundcards installed in the system
!!--------------------------------------
!!Modprobe options (Sound related)
!!--------------------------------
snd_pcsp: index=-2snd_usb_audio: index=-2snd_atiixp_modem: index=-2snd_intel8x0m: index=-2snd_via82xx_modem: index=-2snd_atiixp_modem: index=-2snd_intel8x0m: index=-2snd_via82xx_modem: index=-2snd_usb_audio: index=-2snd_usb_caiaq: index=-2snd_usb_ua101: index=-2snd_usb_us122l: index=-2snd_usb_usx2y: index=-2snd_cmipci: mpu_port=0x330 fm_port=0x388snd_pcsp: index=-2snd_usb_audio: index=-2
!!Loaded sound module options
!!---------------------------
!!Module: snd_usb_audio
autoclock : Y delayed_register : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null) device_setup : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 enable : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y id : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null) ignore_ctl_error : N implicit_fb : N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N index : -2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 pid : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 quirk_alias : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null) skip_validation : N use_vmalloc : Y vid : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
!!USB Mixer information
!!---------------------
--startcollapse--
USB Mixer: usb_id=0x19082070, ctrlif=0, ctlerr=0
Card: Generic USB2.0 Device at usb-0000:04:00.0-2.1, full speed
Unit: 2
Control: name="PCM Playback Volume", index=0
Info: id=2, control=2, cmask=0x0, channels=1, type="S16"
Volume: min=-32768, max=-32513, dBmin=0, dBmax=0
Unit: 2
Control: name="PCM Playback Switch", index=0
Info: id=2, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN"
Volume: min=0, max=1, dBmin=0, dBmax=0--endcollapse--
!!ALSA Device nodes
!!-----------------
crw-rw---- 1 root audio 116, 3 Nov 5 11:39 /dev/snd/controlC1 crw-rw---- 1 root audio 116, 2 Nov 5 11:39 /dev/snd/pcmC1D0p crw-rw---- 1 root audio 116, 1 Nov 5 11:39 /dev/snd/seq crw-rw---- 1 root audio 116, 33 Nov 5 11:39 /dev/snd/timer
/dev/snd/by-id:
total 0
drwxr-xr-x 2 root root 60 Nov 5 11:39 . drwxr-xr-x 4 root root 160 Nov 5 11:39 .. lrwxrwxrwx 1 root root 12 Nov 5 11:39 usb-Generic_USB2.0_Device_20130100ph0-00 -> ../controlC1
/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root 60 Nov 5 11:39 . drwxr-xr-x 4 root root 160 Nov 5 11:39 .. lrwxrwxrwx 1 root root 12 Nov 5 11:39 platform-e00000000.pcie-pci-0000:04:00.0-usb-0:2.1:1.0 -> ../controlC1
!!Aplay/Arecord output
!!--------------------
APLAY
**** List of PLAYBACK Hardware Devices ****
card 1: Device [USB2.0 Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
ARECORD
**** List of CAPTURE Hardware Devices ****
!!Amixer output
!!-------------
!!-------Mixer controls for card Device
Card hw:1 'Device'/'Generic USB2.0 Device at usb-0000:04:00.0-2.1, full speed'
Mixer name : 'USB Mixer'
Components : 'USB1908:2070'
Controls : 3
Simple ctrls : 1
Simple mixer control 'PCM',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined Playback channels: Mono
Limits: Playback 0 - 255
Mono: Playback 192 [75%] [on]
!!Alsactl output
!!--------------
--startcollapse--
state.Device {
control.1 {
iface PCM
name 'Playback Channel Map'
value.0 0
value.1 0
comment {
access read
type INTEGER
count 2
range '0 - 36'
}
}
control.2 {
iface MIXER
name 'PCM Playback Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.3 {
iface MIXER
name 'PCM Playback Volume'
value 192
comment {
access 'read write'
type INTEGER
count 1
range '0 - 255'
}
}
}--endcollapse--
!!All Loaded Modules
!!------------------
async_memcpyasync_pqasync_raid6_recovasync_txasync_xor
autofs4
backlightblake2b_generic
btrfsda9063_onkeyda9063_regulatordm_multipath
drmi2c_ocoresip_tables
libcrc32c
linear
lm90
macb
macsec
mc
mscc
multipathnls_iso8859_1
nvmenvme_core
phylink
raid0
raid1
raid10
raid456raid6_pqrtc_da9063sch_fq_codelscsi_dh_aluascsi_dh_emcscsi_dh_rdac
sndsnd_hwdepsnd_pcmsnd_rawmidisnd_seqsnd_seq_devicesnd_seq_midisnd_seq_midi_eventsnd_timersnd_usb_audiosnd_usbmidi_lib
soundcore
uiouio_pdrv_genirqx_tablesxhci_pcixhci_pci_renesas
xor
!!ALSA/HDA dmesg
!!--------------
[ 220.902815] usb 1-2.1: 2:0: bogus dB values (-12800/-12700), disabling dB reporting [ 220.905314] usbcore: registered new interface driver snd-usb-audio
!!Packages installed
!!--------------------
ii alsa-tools 1.2.2-1 riscv64 Console based ALSA utilities for specific hardware ii alsa-topology-conf 1.2.4-1 all ALSA topology configuration files ii alsa-ucm-conf 1.2.4-2ubuntu1.4 all ALSA Use Case Manager configuration files ii alsa-utils 1.2.4-1ubuntu3 riscv64 Utilities for configuring and using ALSA
Quoted 5 lines · Kip Warner
Quoted 1 line · Takashi Iwai
Check the contents in /proc/asound/cards. Is that empty as well?
Thanks for getting back to me, Takashi. Looks like it's empty:
No, it contains the card entry. You can see it in alsa-info.sh output you attached, which is:
Quoted 10 lines
!!Soundcards recognised by ALSA
!!-----------------------------1 [Device ]: USB-Audio - USB2.0 Device
Generic USB2.0 Device at usb-0000:04:00.0-2.1, full speedQuoted 1 line
If the card is recognized there, check the
/sys/class/sound/*.This is what I see in that directory:
Quoted 7 lines
$ sudo tree /sys/class/sound/ /sys/class/sound/ ├── card1 -> ../../devices/platform/soc/e00000000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/0000:02:02.0/0000:04:00.0/usb1/1-2/1-2.1/1-2.1:1.0/sound/card1 ├── controlC1 -> ../../devices/platform/soc/e00000000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/0000:02:02.0/0000:04:00.0/usb1/1-2/1-2.1/1-2.1:1.0/sound/card1/controlC1 ├── pcmC1D0p -> ../../devices/platform/soc/e00000000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/0000:02:02.0/0000:04:00.0/usb1/1-2/1-2.1/1-2.1:1.0/sound/card1/pcmC1D0p ├── seq -> ../../devices/virtual/sound/seq └── timer -> ../../devices/virtual/sound/timer
So all files look fine.
Quoted 5 lines
Quoted 2 lines
If a PCM device is found there, it must be the lack of the corresponding device in
/dev/snd/*that is usually created via udev.And this is what I see there:
Quoted 10 lines
$ sudo tree /dev/snd/ /dev/snd/ ├── by-id │ └── usb-Generic_USB2.0_Device_20130100ph0-00 -> ../controlC1 ├── by-path │ └── platform-e00000000.pcie-pci-0000:04:00.0-usb-0:2.1:1.0 -> ../controlC1 ├── controlC1 ├── pcmC1D0p ├── seq └── timer
Here, too.
Quoted 1 line
I've also attached the output of the alsa-info(1) generated log.
... and this looks also fine.
Try to run like
% aplay -Dplughw:1 -vv foo.wav
If this works, the problem is rather the access via PulseAudio.
Takashi
Quoted 2 lines · Takashi Iwai
No, it contains the card entry. You can see it in
alsa-info.shoutput you attached, which is:
I thought cards was supposed to be a directory populated with something, but I see now that its a file containing the aforementioned.
Quoted 4 lines
Try to run like
% aplay -Dplughw:1 -vv foo.wav
If this works, the problem is rather the access via PulseAudio.
Unfortunately it didn't:
$ aplay -Dplughw:1 -vv /usr/share/games/lincity-ng/sounds/Water1.wav ALSA lib pcm_hw.c:1829:(_snd_pcm_hw_open) Invalid value for card aplay: main:852: audio open error: No such file or directory
$ aplay -l aplay: device_list:276: no soundcards found...
Signature · 3 lines
Kip Warner -- Senior Software Engineer OpenPGP signed/encrypted mail preferred https://www.thevertigo.com
Quoted 13 lines · Kip Warner
Quoted 2 lines · Takashi Iwai
No, it contains the card entry. You can see it in
alsa-info.shoutput you attached, which is:I thought cards was supposed to be a directory populated with something, but I see now that its a file containing the aforementioned.
Quoted 4 lines
Try to run like
% aplay -Dplughw:1 -vv foo.wav
If this works, the problem is rather the access via PulseAudio.
Quoted 8 lines
Unfortunately it didn't:
$ aplay -Dplughw:1 -vv /usr/share/games/lincity-ng/sounds/Water1.wav ALSA lib pcm_hw.c:1829:(_snd_pcm_hw_open) Invalid value for card aplay: main:852: audio open error: No such file or directory$ aplay -l aplay: device_list:276: no soundcards found...
How about to run as root?
Takashi
Quoted 1 line · Takashi Iwai
How about to run as root?
It works as root!
$ sudo aplay -Dplughw:1 -vv /usr/share/games/lincity-ng/sounds/Water1.wav
So there appears to be a permission issue. I wonder why?
Signature · 3 lines
Kip Warner -- Senior Software Engineer OpenPGP signed/encrypted mail preferred https://www.thevertigo.com
Quoted 9 lines · Kip Warner
Quoted 1 line · Takashi Iwai
How about to run as root?
It works as root!
$ sudo aplay -Dplughw:1 -vv /usr/share/games/lincity-ng/sounds/Water1.wavSo there appears to be a permission issue. I wonder why?
It depends rather on your system setup and desktop environment. Usually the device file permissions are managed by logind and modified dynamically at login via ACL.
As it's no kernel issue, better to ask your distro.
Takashi
Quoted 5 lines · Takashi Iwai
It depends rather on your system setup and desktop environment. Usually the device file permissions are managed by logind and modified dynamically at login via ACL.
As it's no kernel issue, better to ask your distro.
It probably is a distro issue. But at least we know now that it works and it's just a matter of fiddling with permissions. Thanks Takashi.
Signature · 3 lines
Kip Warner -- Senior Software Engineer OpenPGP signed/encrypted mail preferred https://www.thevertigo.com
A message that is not in the archive (sent off-list or not yet received): CACc2_6-e4JCOBc-kE4_i6HNYt6x1xsSd73Hikr9PKn3vYdcxaQ@mail.gmail.com
Quoted 3 lines · chris hermansen
To allow remote users to use ALSA, you need to add those users to the audio group, however this is not recommended by default (see note below).
Thanks Chris. For anyone else having a similar problem, adding myself to the audio group, like so, fixed the problem:
$ sudo usermod -a -G audio kip
Signature · 3 lines
Kip Warner -- Senior Software Engineer OpenPGP signed/encrypted mail preferred https://www.thevertigo.com