• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
connecting a microphone via USB
#1
Dear Armin,

To run a container application which is developed on commercial raspberry pi, I need to map a microphone via USB port.
I think a directory '/dev/snd' must be mounted when creating a new container on netPI.

But,  the attached failure message appears when deployed.
Is there any solution to activate the microphone device?

Thank you very much for your support.
Best regards,


Attached Files Thumbnail(s)
   
  Reply
#2
Hello Tad,

you are trying to map a "volume". This is not correct.

You have to map a "device" since /dev/snd is a device. Like here as example: https://registry.hub.docker.com/r/hilsch...ktop-hdmi/

To be honest, I have not made any experience with a microphone yet. So you need to collect your own experience with it.

Regards
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
Dear Armin,

Thank you very much for your support.

I mapped the device as /dev/snd:/dev/snd.
After that, I entered below from the console.
That means Linux detects a device with integrated speaker and microphone (Jabra SPEAK) as 'Bus 001 Device 007'.
But, arecord doesn't recognize this device.

root@raspberrypi:/# lsusb
Bus 001 Device 007: ID 0b0e:0420 GN Netcom Jabra SPEAK 510
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@raspberrypi:/# arecord -l
**** List of CAPTURE Hardware Devices ****
root@raspberrypi:/#

If 'hilschernetpi/netpi-raspbian' is deployed on a commercial Raspberry Pi with Docker, the USB device is recognized only by enabling a privileged mode.

pi@testmic03:~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 2: Microphone [USB Microphone], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
pi@testmic03:~$

Do you think netPI has some limitations for microphone input?

Thank you very much for your support.
Best regards,
  Reply
#4
You say the microphone is recognized on a commercial Raspberry Pi if you enable "privileged" mode, correct?

But what happens if you enable "privileged" mode on the netPI too? Have you tried this already?

There is one important point to know in general about Docker and USB. Every time a container is started then Docker makes a snapshot of the connected USB devices and maps them into the container. If you connect USB devices after the container is started they will not be recognized. So make sure you have connected the USB device when you power on netPI and the containers are started later by Docker automatically. Then your are safe.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#5
In order to get out the problem we can debug the "arecord" program using another program called "strace".

It is tracing all Linux calls of a program. If not already installed in the container instrall strace using "apt install strace" command first.

Then to debug call "strace arecord -l 2>mytrace.txt" and it will be tracing all outputs to the "mytrace.txt" file. After that post the "mytrace.txt" and maybe I can recognize what the problem is. Maybe it is a missing microphone Linux kernel driver, I don't know.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#6
There is another idea. Please run the container also in "host" network mode. Maybe this also has an influence.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#7
Dear Armin,

Thank you very much for your help.
I attached 'mytrace.txt' which was gathered as follows.

root@raspberrypi:/home/pi# strace arecord 1 2>mytrace.txt
root@raspberrypi:/home/pi# lsusb
Bus 001 Device 004: ID 0b0e:0420 GN Netcom Jabra SPEAK 510
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@raspberrypi:/home/pi# arecord -l
**** List of CAPTURE Hardware Devices ****
root@raspberrypi:/home/pi#

I have always activated privileged mode and mapped /dev/snd:/dev/snd on my netPI.
Even if Network=bridge to host, I see the same phenomenon between bridge and host.

I tried to reproduce 'mytrace.txt' again with a different USB device (microphone).
I will then inform you its result.

Best regards,


Attached Files
.txt   mytrace.txt (Size: 29.53 KB / Downloads: 1)
  Reply
#8
Well I have one question. Have you installed the "alsa" driver tools in your Raspbian container?

Here is the example taken from the Dockerfile https://github.com/HilscherAutomation/ne...Dockerfile

"apt install -y alsa-oss alsa-tools alsa-tools-gui alsa-utils alsamixergui mpg123"

Please call this command line and try again
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#9
How is the same trace using the tool on a commercial Raspberry Pi? Please repeat it and then we can compare the two files.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#10
I watched your logfile.

It says: uname({sysname="Linux", nodename="raspberrypi", ...}) = 0

So did make this trace on the commercial Raspberry Pi or on netPI?
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Connecting Monitor to netPi paulj19 4 2,897 January-30th-2020, 02:23 PM
Last Post: paulj19

Forum Jump:


Users browsing this thread: 1 Guest(s)