Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arecord not working on embedded ARM target. #347

Closed
grahamnaylorccfe opened this issue Jun 22, 2020 · 67 comments
Closed

arecord not working on embedded ARM target. #347

grahamnaylorccfe opened this issue Jun 22, 2020 · 67 comments

Comments

@grahamnaylorccfe
Copy link

grahamnaylorccfe commented Jun 22, 2020

I have an embedded A9 coretex ARM running on a Zynq chip with an Ubuntu like Petalinux OS. I managed to install the dependencies and bluez-alsa downloaded from master yesterday (21/6/2020, so v2.1 with bluez 5.48). I have similar issues as issue #262 in that aplay works fine on both a2dp and sco (eg with aplay -D bluealsa:SRV=org.bluealsa,DEV=50:19:01:90:7F:39,PROFILE=sco sample.wav ), however when trying to record (you see I need the mic input as I am tring to build an SDR) I get no sound a recorded file of just 44 bytes (using arecord -D bluealsa:SRV=org.bluealsa,DEV=50:19:01:90:7F:39,PROFILE=sco recorded.wav).
I have tried with an Asus USB BT dongle with the Broadsom chip (BCM20702A1 (001.002.014)) and get the same problem with another BT dongle using a CSR chip. For the Broadcom I have the .hcd driver in /lib/firmware/brcm/ , though it does seem that there are two in circulation (BCM20702A1-0a5c-21e8.hcd) and also BCM20702A1-0b05-17cb.hcd, though I have put both in for good measure (both 34kB). No errors in dmesg and all seems OK, but nothing on record.

@borine has helpfully suggested using btmon --sco to diagnose issues on the sco channel during an attempted record, but don't know what to make of it. Any ideas?:

@ RAW Open: bluealsa (privileged) version 2.22 {0x0003} 137.389523
@ RAW Close: bluealsa {0x0003} 137.389976
< HCI Command: Exit Sniff Mode (0x02|0x0004) plen 2 #2040 [hci0] 137.390455
Handle: 12

HCI Event: Command Status (0x0f) plen 4 #2041 [hci0] 137.391115
Exit Sniff Mode (0x02|0x0004) ncmd 1
Status: Success (0x00)
HCI Event: Mode Change (0x14) plen 6 #2042 [hci0] 137.685101
Status: Success (0x00)
Handle: 12
Mode: Active (0x00)
Interval: 0.000 msec (0x0000)
< HCI Command: Setup Synchronous Connection (0x01|0x0028) plen 17 #2043 [hci0] 137.685174
Handle: 12
Transmit bandwidth: 8000
Receive bandwidth: 8000
Max latency: 10
Setting: 0x0060
Input Coding: Linear
Input Data Format: 2's complement
Input Sample Size: 16-bit
# of bits padding at MSB: 0
Air Coding Format: CVSD
Retransmission effort: Optimize for power consumption (0x01)
Packet type: 0x0380
3-EV3 may not be used
2-EV5 may not be used
3-EV5 may not be used
HCI Event: Command Status (0x0f) plen 4 #2044 [hci0] 137.686098
Setup Synchronous Connection (0x01|0x0028) ncmd 1
Status: Success (0x00)
HCI Event: Synchronous Connect Complete (0x2c) plen 17 #2045 [hci0] 137.695099
Status: Success (0x00)
Handle: 6
Address: 50:19:01:90:7F:39 (OUI 50-19-01)
Link type: eSCO (0x02)
Transmission interval: 0x0c
Retransmission window: 0x02
RX packet length: 60
TX packet length: 60
Air mode: CVSD (0x02)
< SCO Data TX: Handle 6 flags 0x00 dlen 48 #2046 [hci0] 137.698871
01 e4 f0 e3 68 e4 49 e5 e3 e6 85 e8 93 e9 55 eb ....h.I.......U.
4d ed 3c ef 81 f1 b7 f3 42 f5 99 f6 b3 f8 e8 fa M.<.....B.......
15 fd 6c ff 39 00 48 01 5d 03 11 05 2f 06 40 07 ..l.9.H.].../.@.
HCI Event: Mode Change (0x14) plen 6 #2047 [hci0] 167.712922
Status: Success (0x00)
Handle: 12
Mode: Sniff (0x02)
Interval: 100.000 msec (0x00a0)
< HCI Command: Disconnect (0x01|0x0006) plen 3 #2048 [hci0] 181.718741
Handle: 6
Reason: Remote User Terminated Connection (0x13)
HCI Event: Command Status (0x0f) plen 4 #2049 [hci0] 181.719856
Disconnect (0x01|0x0006) ncmd 1
Status: Success (0x00)
HCI Event: Disconnect Complete (0x05) plen 4 #2050 [hci0] 181.780838
Status: Success (0x00)
Handle: 6
Reason: Connection Terminated By Local Host (0x16)

It looked as though it started streaming, but then stopped as if it was going in to a brick wall.

cheers
G

@grahamnaylorccfe
Copy link
Author

For info, I launched bluealsa using:
bluealsa -p a2dp-source -p a2dp-sink -p hfp-hf -p hfp-ag -p hsp-hs -p hsp-ag -p hfp-ofono
to try and cover all bases!

With the Broadcom I reproducibly get the following monitor output when trying to record:
RAW Open: bluealsa (privileged) version 2.22 {0x0003} 20.876873
@ RAW Close: bluealsa {0x0003} 20.877322
< HCI Command: Setup Synchronous Connection (0x01|0x0028) plen 17 #2037 [hci0] 20.877799
Handle: 12
Transmit bandwidth: 8000
Receive bandwidth: 8000
Max latency: 10
Setting: 0x0060
Input Coding: Linear
Input Data Format: 2's complement
Input Sample Size: 16-bit
# of bits padding at MSB: 0
Air Coding Format: CVSD
Retransmission effort: Optimize for power consumption (0x01)
Packet type: 0x0380
3-EV3 may not be used
2-EV5 may not be used
3-EV5 may not be used

HCI Event: Command Status (0x0f) plen 4 #2038 [hci0] 20.883304
Setup Synchronous Connection (0x01|0x0028) ncmd 1
Status: Success (0x00)
HCI Event: Synchronous Connect Complete (0x2c) plen 17 #2039 [hci0] 20.912228
Status: Success (0x00)
Handle: 6
Address: 50:19:01:90:7F:39 (OUI 50-19-01)
Link type: eSCO (0x02)
Transmission interval: 0x0c
Retransmission window: 0x02
RX packet length: 60
TX packet length: 60
Air mode: CVSD (0x02)
< SCO Data TX: Handle 6 flags 0x00 dlen 48 #2040 [hci0] 20.916940
59 ed 6a ea 89 e8 59 e7 64 e5 20 e4 f3 e3 07 e4 Y.j...Y.d. .....
01 e4 f0 e3 68 e4 49 e5 e3 e6 85 e8 93 e9 55 eb ....h.I.......U.
4d ed 3c ef 81 f1 b7 f3 42 f5 99 f6 b3 f8 e8 fa M.<.....B.......
< SCO Data TX: Handle 6 flags 0x00 dlen 48 #2041 [hci0] 20.920276
15 fd 6c ff 39 00 48 01 5d 03 11 05 2f 06 40 07 ..l.9.H.].../.@.
6e 08 f9 08 db 09 fe 09 14 0a cf 0a 2c 0b b9 0a n...........,...
79 0a f1 0a 45 0a d6 09 24 0a e1 09 42 09 e8 08 y...E...$...B...
< HCI Command: Disconnect (0x01|0x0006) plen 3 #2042 [hci0] 27.260320
Handle: 6
Reason: Remote User Terminated Connection (0x13)
HCI Event: Command Status (0x0f) plen 4 #2043 [hci0] 27.263242
Disconnect (0x01|0x0006) ncmd 1
Status: Success (0x00)
HCI Event: Disconnect Complete (0x05) plen 4 #2044 [hci0] 27.267227
Status: Success (0x00)
Handle: 6
Reason: Connection Terminated By Local Host (0x16)

It seems to be sending two blocks of 48 bytes but then maybe some buffer becomes full?

@borine
Copy link
Collaborator

borine commented Jun 24, 2020

Hi Graham
The btmon suggestion was just to confirm that SCO data packets are actually being routed through the HCI. Your traces above show that none are received by the host (no RX), and that the SCO link is terminated by the local host. To find out why, you need to look at bluetoothd and bluealsa logs. Run bluetoothd with -d option to get debug info; bluealsa needs to be built with --enable-debug at the configure step.

I would recommend you start bluealsa with only one profile to minimize the number of variables here. If your microphone supports HSP then that is the simplest SCO profile and is the best bet for initial troubleshooting:

bluealsa -p hsp-ag

If there is no HSP support, or once you have HSP working, then if required try HFP:

bluealsa -p hfp-ag

Finally, try in combination with A2DP if required.

Do not use the hsp-hs or hfp-hf profiles, they are for the microphone/speaker end of the link; from your description it looks like you are trying to build a gateway.

@borine
Copy link
Collaborator

borine commented Jun 25, 2020

A quick web search found this, which may (or may not) be helpful for your Asus adapter:

https://community.cypress.com/message/30511#30511

@borine
Copy link
Collaborator

borine commented Jun 25, 2020

A bit more research ...

The naming convention for Broadcom USB firmware is BCM20702A1-<VID>-<PID>.hcd where VID and PID are the USB vendor and product ids. To see the VID and PID for your adapter(s), type

lsusb

You will see ID xxxx:xxxx against each. Make sure you have the correct firmware. There are a number of different firmwares available at: https://github.com/winterheart/broadcom-bt-firmware/tree/master/brcm

@grahamnaylorccfe
Copy link
Author

Thanks alot for all your help @borine - this is where I have got to so for (no cigar yet I'm afraid):
I downloaded the firmware you suggested (I had the reference number correct for my version as reported by lsusb as it is the want that was claimed to be missing in the dmesg report. Curiously the one from the repo you pointed to had a different md5 checksum to the one I had. Anyway, with this version I again get perfect response with aplay, but still nothing on arecord. I am not sure how to get the command hci_bcm_write_sco_pcm_int(1,0,0,0,0) to work as I get the response command not found. Where should this be launched from? I will try and check the other debugging outputs you suggested previously for clues.
cheers
Graham

@grahamnaylorccfe
Copy link
Author

BTW I launched bluealsa with -p hsp-ag as it didn't respond with -p hfp-ag

@arkq
Copy link
Owner

arkq commented Jun 25, 2020

@grahamnaylorccfe have you tried to use aplay and then simultaneously arecord? Maybe your headset requires "input" in order to send something?

EDIT:
After looking at btmon output (from your first comment) my suggestion is futile... Otherwise, there would be RX data recorded :/

@borine
Copy link
Collaborator

borine commented Jun 25, 2020

I am not sure how to get the command hci_bcm_write_sco_pcm_int(1,0,0,0,0)

OK, bluealsa tries to do that part for you, with Broadcom bluetooth modules. Please can you post the output of:

hciconfig -a

which should confirm whether the module is reporting itself as Broadcom ?

@arkq
Copy link
Owner

arkq commented Jun 25, 2020

@borine for my private builds I'm using the broadcom setup also for cypress chips (after cypress acquired broadcom), but I'm not sure whether this will work in all cypress cases so this commit is not mainlined.

EDIT:
@grahamnaylorccfe you might try to add cypress to the if statement as follows:
https://github.com/Arkq/bluez-alsa/blob/master/src/sco.c#L161

if (a->chip.manufacturer == BT_COMPID_BROADCOM ||
    a->chip.manufacturer == BT_COMPID_CYPRESS) {

However, I'm not sure whether it will help, because since playback works, chip has to read data from HCI, not from PCM interface.

@borine
Copy link
Collaborator

borine commented Jun 25, 2020

after cypress acquired broadcom

and now Infineon has bought Cypress 😄

@grahamnaylorccfe
Copy link
Author

@grahamnaylorccfe have you tried to use aplay and then simultaneously arecord? Maybe your headset requires "input" in order to send something?

EDIT:
After looking at btmon output (from your first comment) my suggestion is futile... Otherwise, there would be RX data recorded :/

Yes - tried playing on one terminal and record on another - no luck, aplay works just fine but arecord still gives only a 44 byte file. The dongle announces itself as Broadcom so I guess adding Cypress won't help.

@grahamnaylorccfe
Copy link
Author

I am not sure how to get the command hci_bcm_write_sco_pcm_int(1,0,0,0,0)

OK, bluealsa tries to do that part for you, with Broadcom bluetooth modules. Please can you post the output of:

hciconfig -a

which should confirm whether the module is reporting itself as Broadcom ?

hciconfig -a
hci0: Type: Primary Bus: USB
BD Address: 5C:F3:70:99:0E:8C ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN
RX bytes:14969 acl:288 sco:0 events:635 errors:0
TX bytes:768056 acl:275 sco:14196 commands:367 errors:0
Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH SNIFF
Link mode: SLAVE ACCEPT
Name: 'koheron'
Class: 0x200000
Service Classes: Audio
Device Class: Miscellaneous,
HCI Version: 4.0 (0x6) Revision: 0x15bb
LMP Version: 4.0 (0x6) Subversion: 0x220e
Manufacturer: Broadcom Corporation (15)

@arkq
Copy link
Owner

arkq commented Jun 25, 2020

The dongle announces itself as Broadcom so I guess adding Cypress won't help.

So maybe this fix actually breaks somethings... Try to remove the "if" block from my previous comment - lets keep everything as a default. Before test reboot the board/PC.

@grahamnaylorccfe
Copy link
Author

Hi Graham
The btmon suggestion was just to confirm that SCO data packets are actually being routed through the HCI. Your traces above show that none are received by the host (no RX), and that the SCO link is terminated by the local host. To find out why, you need to look at bluetoothd and bluealsa logs. Run bluetoothd with -d option to get debug info; bluealsa needs to be built with --enable-debug at the configure step.

I would recommend you start bluealsa with only one profile to minimize the number of variables here. If your microphone supports HSP then that is the simplest SCO profile and is the best bet for initial troubleshooting:

bluealsa -p hsp-ag

If there is no HSP support, or once you have HSP working, then if required try HFP:

bluealsa -p hfp-ag

Finally, try in combination with A2DP if required.

Do not use the hsp-hs or hfp-hf profiles, they are for the microphone/speaker end of the link; from your description it looks like you are trying to build a gateway.

I had built the bluez-alsa with debug enabled, here is the transcript when trying to record:

Initially connecting:

bluealsa: D: ../../src/dbus.c:57: Called: org.bluez.Profile1.NewConnection() on /org/bluez/HSP/AudioGateway
bluealsa: D: ../../src/ba-rfcomm.c:1263: Created new RFCOMM thread [ba-rfcomm]: HSP Audio Gateway
bluealsa: D: ../../src/bluez.c:1050: HSP Audio Gateway configured for device 50:19:01:90:7F:39
bluealsa: D: ../../src/ba-transport.c:721: State transition: 0 -> 2
bluealsa: D: ../../src/ba-transport.c:997: Created new thread [ba-sco]: HSP Audio Gateway
bluealsa: D: ../../src/ba-rfcomm.c:880: Starting RFCOMM loop: HSP Audio Gateway
bluealsa: D: ../../src/ba-rfcomm.c:127: RFCOMM: HSP Audio Gateway state transition: 0 -> 9
bluealsa: D: ../../src/sco.c:241: Starting SCO loop: HSP Audio Gateway
bluealsa: D: ../../src/at.c:161: AT message: SET: command:+VGS, value:12
bluealsa: D: ../../src/ba-rfcomm.c:108: Sending AT message: RESP: command:(null), value:OK
bluealsa: D: ../../src/at.c:161: AT message: SET: command:+XAPL, value:0012-0001-0100,3
bluealsa: D: ../../src/ba-rfcomm.c:108: Sending AT message: RESP: command:(null), value:+XAPL=BlueALSA,6
bluealsa: D: ../../src/ba-rfcomm.c:108: Sending AT message: RESP: command:(null), value:OK
bluealsa: D: ../../src/at.c:161: AT message: SET: command:+IPHONEACCEV, value:2,1,9,2,0
bluealsa: D: ../../src/ba-rfcomm.c:108: Sending AT message: RESP: command:(null), value:OK


#Then running arecord......


bluealsa: D: ../../src/dbus.c:57: Called: org.bluealsa.Manager1.GetPCMs() on /org/bluealsa
bluealsa: D: ../../src/dbus.c:57: Called: org.bluealsa.PCM1.Open() on /org/bluealsa/hci0/dev_50_19_01_90_7F_39/hspag/source
bluealsa: D: ../../src/ba-transport.c:929: New SCO link: 50:19:01:90:7F:39: 18
bluealsa: D: ../../src/hci.c:132: SCO link socket MTU: 18: 64
bluealsa: D: ../../src/ba-transport.c:721: State transition: 2 -> 2


#Then ^C to escape


bluealsa: D: ../../src/ba-transport.c:971: Closing PCM: 15
bluealsa: D: ../../src/sco.c:328: Releasing SCO due to PCM inactivity
bluealsa: D: ../../src/ba-transport.c:947: Closing SCO: 18

@grahamnaylorccfe
Copy link
Author

I killed bluetoothd and relaunched as bluetoothd -d and then restarted bluealsa. I don't get any debug messages from bluetoothd when connecting and trying aplay (succesfully) and arecord (unsuccesfully).

@borine
Copy link
Collaborator

borine commented Jun 26, 2020

hmm, according to https://bluekitchen-gmbh.com/btstack/chipsets/ CSR USB adapters always route SCO over HCI, whereas Broadcom USB adapters by default route SCO to I2S/PCM, and so always need the vendor command to switch routing to HCI. The fact that both CSR and Broadcom are failing in the same way here suggests that SCO routing is not the real issue here after all.

Perhaps the microphone is simply not transmitting any audio ? Is there any way to check that (an LED or other indicator on the headset/microphone perhaps). Is this headset known to work with other systems (linux/mac/windows) ?

@grahamnaylorccfe
Copy link
Author

I tried the headset and USB dongle on an Ubuntu 18.04 installation on a regular PC and was able to detect sound from the microphone and sound back to the earpiece using the audio test facility in settings. Echo testing to Skype also worked fine. Back on the embedded board I have tried a few other headsets with the same problem on record. Do you recommend any particular USB dongle to BT headset that is known to work. Ultimately I will need this to work to a waterproof headset for use underground (cave rescue). cheers Graham

@borine
Copy link
Collaborator

borine commented Jun 27, 2020

If the headset/dongle combination works with pulseaudio on Ubuntu 18.04 then it should work with bluealsa also. Its a mystery to me why no SCO data is being received on the HCI on your embedded board.

If you have time to install bluealsa and test on the Ubuntu 18.04 machine, that would help to be sure this is not a bluealsa bug. You will have to temporarily disable pulseaudio to do this (do not use sudo !):

systemctl --user stop pulseaudio.service pulseaudio.socket

Restart pulseaudio later with

systemctl --user start pulseaudio

Please can you test with both dongles (with both pulseaudio and bluealsa) so we can know whether both should be OK on the embedded board.

EDIT
I forgot - Ubuntu also runs an instance of pulseaudio with the display manager - stop this with:

echo "autospawn = 0" | sudo tee /var/lib/gdm3/.config/pulse/client.conf
sudo chown gdm:gdm /var/lib/gdm3/.config/pulse/client.conf
sudo killall pulseaudio

To restore it,
sudo rm /var/lib/gdm3/.config/pulse/client.conf

@grahamnaylorccfe
Copy link
Author

Thanks for your suggestions @borine . Here is where I have got to:
I found another embedded Arm board (Zedboard) that runs Xillinux which is Lubuntu 16.04.
My headsets connected and were able to work with pulseaudio on play and recored (paplay and parecord, using the CSR USB dongle), so I went ahead and installed bluez-alsa (after compiling and installing all the dependencies) and follow your instructions above
Now generally I run as root on these embedded board, but got the following error trying to disable pulse audio in th display manager:
~# echo "autospawn = 0" | sudo tee /var/lib/gdm3/.config/pulse/client.conf
tee: /var/lib/gdm3/.config/pulse/client.conf: No such file or directory
autospawn = 0

Now there aren't any pulseaudio processes returned by ps -ef, so I launch bluealsa and try in another window running aplay, but get the error:
~# aplay -D bluealsa:SRV=org.bluealsa,DEV=50:19:01:90:7F:39,PROFILE=sco sample.wav
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM bluealsa:SRV=org.bluealsa,DEV=50:19:01:90:7F:39,PROFILE=sco
aplay: main:722: audio open error: No such file or directory

I think I must be missing something fundamental - sorry for being a bit slow on this!
You may ask why I don't just run pulseaudio on the Zedboard since that appears to work on both play and record (input and output) - the reason is that the board is rather large and I need to use the somewhat more compact Cora Zynq board.
cheers
Graham

@borine
Copy link
Collaborator

borine commented Jun 28, 2020

ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM
bluealsa:SRV=org.bluealsa,DEV=50:19:01:90:7F:39,PROFILE=sco
aplay: main:722: audio open error: No such file or directory

That error indicates that bluealsa is not installed correctly. Possibly the config file 20-bluealsa.conf is missing or in the wrong directory. I think it should be installed as /usr/share/alsa/alsa.conf.d/20-bluealsa.conf on Ubuntu 16.04.

Also check that the plugin libraries are correctly installed. Not sure how 16.04 organises it libraries, might be

/usr/lib/alsa-lib/libasound_module_ctl_bluealsa.so
/usr/lib/alsa-lib/libasound_module_pcm_bluealsa.so

or something like:

/usr/lib/arm-linux-aaaaaaaa/alsa-lib/libasound_module_ctl_bluealsa.so
/usr/lib/arm-linux-aaaaaaaa/alsa-lib/libasound_module_pcm_bluealsa.so

(where aaaaaaaa is the abi used by this system, gnueabihf or whatever.

If pulseaudio is installed, you'll also see the pulse plugin in the same directory:

libasound_module_pcm_pulse.so

You may ask why I don't just run pulseaudio on the Zedboard since that appears to work on both play and record (input and output) - the reason is that the board is rather large and I need to use the somewhat more compact Cora Zynq board.

Please don't give up on this - I'm very interested to understand why this is not working, and if it turns out there's a bug in bluealsa I'm sure @arkq will be keen to find and fix it!

@arkq
Copy link
Owner

arkq commented Jun 28, 2020

Of course I will help to fix the bug (if it is indeed in bluez-alsa somewhere) :). However, I will repeat my question. @grahamnaylorccfe, please try to build bluez-alsa without Broadcom fixup (e.g. use no-broadcom-setup branch) and check whether it will work or not.

@grahamnaylorccfe
Copy link
Author

Thanks guys - I really appreciate your help on this. I will try the no-broadcom-setup branch and let you know how I get on. Do you think there could be any chance that there is a missing module in the Linux kernel? We believed that everything for BT had been included. Cheers G

@borine
Copy link
Collaborator

borine commented Jun 29, 2020

Do you think there could be any chance that there is a missing module in the Linux kernel

Given that HSP playback is working, I think it is unlikely that any kernel modules are missing. If pulseaudio bluetooth capture is working, then there are definitely no kernel modules missing.

If you can assemble a test platform on which your headset and one or both of your BT dongles work with pulseaudio but not bluealsa and arecord, then when should be able to work out where the error is.

@grahamnaylorccfe
Copy link
Author

I re-built bluez-alsa (after re-imaging the SD card back to a working state) with the no-broadcom-setup (but am using the CSR dongle - will try the ASUS broadcom dongle later)

That error indicates that bluealsa is not installed correctly. Possibly the config file 20-bluealsa.conf is missing or in the wrong directory. I think it should be installed as /usr/share/alsa/alsa.conf.d/20-bluealsa.conf on Ubuntu 16.04.

Yes this file is present.

or something like:

/usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_ctl_bluealsa.so
/usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_bluealsa.so

files also present

If pulseaudio is installed, you'll also see the pulse plugin in the same directory:

libasound_module_pcm_pulse.so

also present

Please don't give up on this - I'm very interested to understand why this is not working, and if it turns out there's a bug in bluealsa I'm sure @arkq will be keen to find and fix it!

Still getting the same error with aplay suggesting the incorrect installation, however I don't think I missed a step.

Will try the Broadcom dongle next

@grahamnaylorccfe
Copy link
Author

Do you think there could be any chance that there is a missing module in the Linux kernel

Given that HSP playback is working, I think it is unlikely that any kernel modules are missing. If pulseaudio bluetooth capture is working, then there are definitely no kernel modules missing.

If you can assemble a test platform on which your headset and one or both of your BT dongles work with pulseaudio but not bluealsa and arecord, then when should be able to work out where the error is.

To be fair, on the smaller board (Cora), pulseaudio does not work on parecord either, hower parecord does work on the larger Zedboard (but with an older Linux kernel, but likely with a different set of kernel modules).

@grahamnaylorccfe
Copy link
Author

Tried with the Broadcom dongle. I get the same error:
[bluetooth]# connect 50:19:01:90:7F:39
Attempting to connect to 50:19:01:90:7F:39
[CHG] Device 50:19:01:90:7F:39 Connected: yes
Connection successful
[Trinida]# quit
[DEL] Controller 5C:F3:70:99:0E:8C localhost.localdomain [default]
root@localhost:# aplay -D bluealsa:SRV=org.bluealsa,DEV=50:19:01:90:7F:39,PROFILE=sco sample.wav
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM bluealsa:SRV=org.bluealsa,DEV=50:19:01:90:7F:39,PROFILE=sco
aplay: main:722: audio open error: No such file or directory
root@localhost:
#

I get this in the bluealsa window:
bluealsa: D: ../../src/ba-transport.c:1020: Created new thread [ba-sco]: HSP Audio Gateway
bluealsa: D: ../../src/sco.c:241: Starting SCO loop: HSP Audio Gateway
bluealsa: D: ../../src/ba-rfcomm.c:880: Starting RFCOMM loop: HSP Audio Gateway
bluealsa: D: ../../src/ba-rfcomm.c:127: RFCOMM: HSP Audio Gateway state transition: 0 -> 9
bluealsa: D: ../../src/at.c:161: AT message: SET: command:+VGS, value:12
bluealsa: D: ../../src/ba-rfcomm.c:108: Sending AT message: RESP: command:(null), value:OK
bluealsa: D: ../../src/at.c:161: AT message: SET: command:+XAPL, value:0012-0001-0100,3
bluealsa: D: ../../src/ba-rfcomm.c:108: Sending AT message: RESP: command:(null), value:+XAPL=BlueALSA,6
bluealsa: D: ../../src/ba-rfcomm.c:108: Sending AT message: RESP: command:(null), value:OK
bluealsa: D: ../../src/at.c:161: AT message: SET: command:+IPHONEACCEV, value:2,1,8,2,0
bluealsa: D: ../../src/ba-rfcomm.c:108: Sending AT message: RESP: command:(null), value:OK

but no logging from the aplay command.

@arkq
Copy link
Owner

arkq commented Jun 30, 2020 via email

@borine
Copy link
Collaborator

borine commented Jun 30, 2020

ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM

That error message is from libasound, and results when snd_config_search_definition() cannot find a match for the given name in its configuration. The name it is looking for in this case is bluealsa. This means that libasaound cannot find, or cannot read, the definition of a pcm.bluealsa (which is in the file 20-bluealsa.conf).

I don't have access to an Lubuntu 16.04 installation, so I can't check where its confgured alsa datadir is. What version of libasound does it have (aplay --version)? I'll look into the source code for that version to see if I can guess some likely locations for its datadir.

@grahamnaylorccfe
Copy link
Author

For the Zedboard:
aplay: version 1.1.0 by Jaroslav Kysela [email protected]
For the Cora
aplay: version 1.1.3 by Jaroslav Kysela [email protected]

G

@borine
Copy link
Collaborator

borine commented Jul 3, 2020

just had a look at alsa-lib 1.1.0 source. It has much less informative error messages than later versions, to the error

ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM

might also result if it found the bluealsa definition, but the parameters were wrong. So perhaps it has on old version of the file libasound_module_pcm_bluealsa.so with a new version of 20-bluealsa.conf, or vice-versa. You could test this by invoking aplay as:

aplay -D bluealsa:DEV=50:19:01:90:7F:39,PROFILE=sco

and see if the outcome or error message changes

@grahamnaylorccfe
Copy link
Author

I just tried again with the recorder. It seems that it was recording from the phone mic and not the headset (durr) but playing back through the headset. Have tried again with skype echo test service a recorded message and I know that worked through the headset mic as I was outside the room with the phone in a drawer! Once I have the log, I will post the btsnoop log.

@grahamnaylorccfe
Copy link
Author

grahamnaylorccfe commented Jul 16, 2020

btsnoop_hci.log
Here is the log from the phone of a skype echo over bluetooth headset (play then record and then play). (was at about 9:24).

@borine
Copy link
Collaborator

borine commented Jul 18, 2020

@grahamnaylorccfe I've ordered an Asus USB-BT400 bluetooth dongle to experiment with, I think (hope) this has the same broadcom chipset as yours. As for the CSR, is that a branded device or generic cheap one? what does hciconfig -a and lsusb say about it?

@grahamnaylorccfe
Copy link
Author

The CSR USB BT dongle is a cheap generic one. If you recommend one that works reliably I am more than happy to give that a go. Anyway, the reponses you requested:

root@koheron:# lsusb
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@koheron:
# hciconfig -a
hci0: Type: Primary Bus: USB
BD Address: 00:1A:7D:DA:71:13 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN
RX bytes:1238 acl:0 sco:0 events:75 errors:0
TX bytes:3042 acl:0 sco:0 commands:75 errors:0
Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'koheron'
Class: 0x200000
Service Classes: Audio
Device Class: Miscellaneous,
HCI Version: 4.0 (0x6) Revision: 0x22bb
LMP Version: 4.0 (0x6) Subversion: 0x22bb
Manufacturer: Cambridge Silicon Radio (10)

@borine
Copy link
Collaborator

borine commented Jul 23, 2020

@grahamnaylorccfe OK, so my Asus USB-BT400 arrived, and HSP playback and recording work fine with it. So I can only assume your issue is a firmware problem.

For reference, mine identifies itself as:

$ dmesg | grep BCM20702A1
BCM20702A1 (001.002.014) build 1467
$ lsusb | grep Broadcom
Bus 001 Device 005: ID 0b05:17cb ASUSTek Computer, Inc. Broadcom BCM20702A0 Bluetooth
$ hciconfig
hci0:	Type: Primary  Bus: USB
	BD Address: 5C:F3:70:9B:FB:1A  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING 
	RX bytes:395443 acl:59 sco:7635 events:335 errors:0
	TX bytes:60584 acl:54 sco:401 commands:267 errors:0

Here's how I got the correct firmware:

  • remove all failed firmware versions from /lib/firmware/brcm
    sudo rm /lib/firmware/brcm/BCM20702A1*

  • plug in the Asus dongle

  • run the following script in an empty directory. It will download the latest Windows driver from the Asus support site and extract the correct firmware from it.

#!/bin/bash

# script to generate current Linux firmware for Asus USB-BT400 

# implements the method found here:
# https://gist.github.com/ssledz/69b7f7b0438e653c08c155e244fdf7d8

WIN_DRIVER="DR_USB_BT400_1201710_Windows.zip"
ASUS_DOWNLOAD_URL="https://dlcdnets.asus.com/pub/ASUS/wireless/USB-BT400/$WIN_DRIVER"

ARCH_FILELIST_URL="https://aur.archlinux.org/cgit/aur.git/tree/filelist.txt?h=bcm20702a1-firmware"

EXTRACTED_ROOT="Win10_USB-BT400_DRIVERS"
HEXFILE_DIR="$EXTRACTED_ROOT/Win10_USB-BT400_Driver_Package/64"

# abort on first error
set -e

# find the required firmware name from dmesg
FIRMWARE=$(dmesg | sed -n '0,/brcm\/BCM20702A1/s/^.*\(BCM20702A1.*hcd\).*$/\1/p')
if [[ -z "$FIRMWARE" ]] ; then
	echo "Unable to identify required firmware from dmesg"
	exit 1
fi

# generate USB ID from firmware name
USB_ID=${FIRMWARE:11:9}
USB_ID=${USB_ID/-/:}
USB_ID=${USB_ID^^}

# lookup firmware hex file name for our USB_ID
HEXFILE=$(curl -s "$ARCH_FILELIST_URL" | grep "$USB_ID")
if [[ -z "$HEXFILE" ]] ; then
	echo "No hexfile match for usb id $USB_ID"
	exit 1
fi
HEXFILE="${HEXFILE:11}"

# download Windows driver from Asus 
if [[ ! -f "$WIN_DRIVER" ]] ; then
	wget "$ASUS_DOWNLOAD_URL"
fi
unzip -qu "$WIN_DRIVER"

# generate firmware hcd file from hex file
hex2hcd -o "$FIRMWARE" "$HEXFILE_DIR/$HEXFILE"

# remove extracted driver file tree
rm -r "$EXTRACTED_ROOT"

echo
echo "Firmware creation complete: filename = $FIRMWARE"
echo "Please install into /lib/firmware/brcm/"
  • if all goes well you will see the message
    Firmware creation complete: filename = BCM20702A1-xxxx-xxxx.hcd

  • unplug the Asus dongle

  • copy the firmware file to /lib/firmware/brcm
    sudo cp *.hcd /lib/firmware/brcm

  • plug in the Asus dongle

Please let me know how this works out for you.

@grahamnaylorccfe
Copy link
Author

Thanks @borine. Sorry for the delay in replying - I had been away on holiday with patchy wifi.. I will try and upgrade my firmware following your instructions - looks like I have build 0000!

@grahamnaylorccfe
Copy link
Author

I have found a version of the BCM20702A1-0b05-17cb.hcd file that I need that reports a build number of 1467 amongst my pile of versions. I will try that and report back.

@grahamnaylorccfe
Copy link
Author

I deleted my previous hcd file and used the one I had previously used with a build number of 1467 and get the following:

root@koheron:# dmesg | grep BCM
[ 1.713615] Bluetooth: hci0: BCM: chip id 63
[ 1.746604] Bluetooth: hci0: BCM20702A
[ 1.750598] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[ 2.567617] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1467
[ 212.075823] Bluetooth: hci0: BCM: chip id 63
[ 212.105819] Bluetooth: hci0: BCM20702A
[ 212.107804] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[ 212.899790] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1467
[51113.627098] Bluetooth: hci0: BCM: chip id 63
[51113.657119] Bluetooth: hci0: BCM20702A
[51113.658117] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[51114.459066] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1467
root@koheron:
# lsusb | grep Broadcom
Bus 001 Device 004: ID 0b05:17cb ASUSTek Computer, Inc. Broadcom BCM20702A0 Bluetooth
root@koheron:~# hciconfig
hci0: Type: Primary Bus: USB
BD Address: 5C:F3:70:99:0E:8C ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING
RX bytes:9913 acl:179 sco:0 events:476 errors:0
TX bytes:145315 acl:181 sco:2026 commands:292 errors:0

I run bluealsa with:
bluealsa -p hsp-ag -p hfp-ag

I connect in bluetoothctl
The aplay command plays a sound file correctly
however the command:
arecord -D bluealsa:SRV=org.bluealsa,DEV=50:19:01:90:7F:39,PROFILE=sco record1.wav
still yields a file with only 44 bytes

report from blualsa:


bluealsa: D: ../../src/ba-transport.c:962: New SCO link: 50:19:01:90:7F:39: 18
bluealsa: D: ../../src/hci.c:132: SCO link socket MTU: 18: 64
bluealsa: D: ../../src/ba-transport.c:787: PCM resumed: 15
bluealsa: D: ../../src/ba-transport.c:1004: Closing PCM: 15
(then hit ^c after a few seconds as nothing seemed to be happening)
bluealsa: D: ../../src/sco.c:328: Releasing SCO due to PCM inactivity
bluealsa: D: ../../src/ba-transport.c:980: Closing SCO: 18


I will try again and download the driver following your method above to see if the result is any different.
Though I attach here the one I had to see if it is any different from yours (the build number looks the same)
BCM20702A1-0b05-17cb.zip

@borine
Copy link
Collaborator

borine commented Aug 5, 2020

The firmware you attached above has the same hash as mine - they are the same.

This line from hciconfig shows that sco traffic is still not being received over the hci:
RX bytes:9913 acl:179 sco:0 events:476 errors:0
In normal operation, you would see both sco RX and TX with aplay, and just sco RX with arecord. You are not seeing sco RX with either. Just to confirm, are you using bluealsa built from master branch, or the one on the no-broadcom-setup branch? I am using master branch.

@grahamnaylorccfe
Copy link
Author

I am still using the no-broadcom-setup branch as indicated in #347 (comment) . Should I revert to master again? Are we sure I am not missing a kernel module?
thanks
Graham

@borine
Copy link
Collaborator

borine commented Aug 7, 2020

Are we sure I am not missing a kernel module?

I am reasonably sure .. the modules you need for USB bluetooth with an Ubuntu kernel are bluetooth, btusb, btbcm

Should I revert to master again?

Yes, but first, while you have the no-broadcom-setup branch installed, please could you try the following commands and post the outputs here?

sudo hcitool -i hci0 cmd 0x3f 0x1d
sudo hcitool -i hci0 cmd 0x3f 0x1c 0x01 0x02 0x00 0x01 0x01

The first reports the current SCO settings. The second changes SCO routing to HCI, which is what the bluealsa master branch code does, but the no-broadcom-setup branch does not.

@grahamnaylorccfe
Copy link
Author

The responses to the above commands:
root@koheron:~# hcitool -i hci0 cmd 0x3f 0x1d
< HCI Command: ogf 0x3f, ocf 0x001d, plen 0

HCI Event: 0x0e plen 9
01 1D FC 00 01 02 00 01 01
root@koheron:~# hcitool -i hci0 cmd 0x3f 0x1c 0x01 0x02 0x00 0x01 0x01
< HCI Command: ogf 0x3f, ocf 0x001c, plen 5
01 02 00 01 01
HCI Event: 0x0e plen 4
01 1C FC 00

@grahamnaylorccfe
Copy link
Author

grahamnaylorccfe commented Aug 7, 2020

After applying the second command I tried connecting to my headset and performing (after a few aplays) arecord - still get no recording and apparently no rx sco packets:
root@koheron:~# hciconfig
hci0: Type: Primary Bus: USB
BD Address: 5C:F3:70:99:0E:8C ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING
RX bytes:7549 acl:85 sco:0 events:388 errors:0
TX bytes:350138 acl:70 sco:6078 commands:299 errors:0

and a few failures signalled by dmesg:
root@koheron:~# dmesg | grep -i bluetooth
[ 0.484587] Bluetooth: Core ver 2.22
[ 0.490104] Bluetooth: HCI device and connection manager initialized
[ 0.495393] Bluetooth: HCI socket layer initialized
[ 0.498870] Bluetooth: L2CAP socket layer initialized
[ 0.502783] Bluetooth: SCO socket layer initialized
[ 1.117906] Bluetooth: HCI UART driver ver 2.3
[ 1.120963] Bluetooth: HCI UART protocol H4 registered
[ 1.125071] Bluetooth: HCI UART protocol Broadcom registered
[ 1.138245] Bluetooth: Generic Bluetooth SDIO driver ver 0.1
[ 1.308895] Bluetooth: RFCOMM socket layer initialized
[ 1.312876] Bluetooth: RFCOMM ver 1.11
[ 1.315302] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 1.319280] Bluetooth: BNEP socket layer initialized
[ 1.714396] Bluetooth: hci0: BCM: chip id 63
[ 1.747415] Bluetooth: hci0: BCM20702A
[ 1.751425] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
[ 2.548439] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1467
[ 2.583438] Bluetooth: hci0: Broadcom Bluetooth Device
[ 533.670238] Bluetooth: hci0 urb ddf84000 submission failed (28)
[ 544.137449] Bluetooth: hci0 urb ddf84200 submission failed (28)
[ 554.272448] Bluetooth: hci0 urb ddf84200 submission failed (28)
[ 571.288465] Bluetooth: hci0 urb ddfb5600 submission failed (28)
[ 776.304670] Bluetooth: hci0 urb ddfb5400 submission failed (28)

Interestingly some of the submission failed entries come from the aplay command - which apparently worked correctly (heard the sound file) - maybe an absence of the monitor source?

@borine
Copy link
Collaborator

borine commented Aug 7, 2020

Hmm, ok so that's the same output I get. It means that SCO routing is initially set to HCI when the adapter is initialized, so HSP recording should "just work" as it does for me, whether you use bluealsa master branch or the no-broadcom-setup branch.

Bluetooth: hci0 urb ddf84000 submission failed (28)

That makes me think its a USB layer issue, not bluetooth. Do you have a USB hub you can try? sometimes errors like that go away when you connect via a hub instead of directly to the usb port on the card. I don't know why - that's a question for a usb forum I think 😄

@grahamnaylorccfe
Copy link
Author

20200807_171353
For your amusement, here is an image of my board. I will try adding a hub!

@borine
Copy link
Collaborator

borine commented Aug 7, 2020

In case it helps, error 28 as reported above is ENOSPC, which, according to https://www.kernel.org/doc/html/latest/driver-api/usb/error-codes.html means "This request would overcommit the usb bandwidth reserved for periodic transfers (interrupt, isochronous)", so it sounds like the usb is being swamped by some other traffic perhaps?

@borine
Copy link
Collaborator

borine commented Aug 7, 2020

also, (clutching at straws, please ignore and accept my apologies if this is insulting) the Cora Z7 reference manual says:

Note that if your design uses the USB Host port (embedded or general purpose), then the Cora Z7 should be powered via a wall adapter capable of providing more power.

@borine
Copy link
Collaborator

borine commented Aug 8, 2020

After a bit more reading, I've found a kernel config item that is relevant to the USB ENOSPC error. From the Kconfig help:

config USB_EHCI_TT_NEWSCHED
	bool "Improved Transaction Translator scheduling"
	depends on USB_EHCI_HCD
	default y
	---help---
	  This changes the periodic scheduling code to fill more of the low
	  and full speed bandwidth available from the Transaction Translator
	  (TT) in USB 2.0 hubs.  Without this, only one transfer will be
	  issued in each microframe, significantly reducing the number of
	  periodic low/fullspeed transfers possible.

	  If you have multiple periodic low/fullspeed devices connected to a
	  highspeed USB hub which is connected to a highspeed USB Host
	  Controller, and some of those devices will not work correctly
	  (possibly due to "ENOSPC" or "-28" errors), say Y.  Conversely, if
	  you have only one such device and it doesn't work, you could try
	  saying N.

	  If unsure, say Y.

Might be worth checking that your kernel was built with this config. On Ubuntu 18.04, I can do:

$ grep USB_EHCI_TT_NEWSCHED /boot/config-4.15.0-99-generic 
CONFIG_USB_EHCI_TT_NEWSCHED=y

@grahamnaylorccfe
Copy link
Author

Thanks @borine for these pointers - hopefully we are homing in on the issue now. Don't worry about potentially being insulting. I have good competencies in some areas, but I admit I am very weak in others. As it happens I would hope modestly to say that I am good on the electronic hardware side, so had been alerted to the potential power supply issue and am using the barrel connector to ensure sufficient current (this is an issue on several such similar boards - and lets face it a microusb is not a serious way to power electronics - just sloppy!). Thanks anyway for checking. Regarding the kernel modules used. I do not have the file you mention, but when I look at the default Xilinx Linux build config (https://github.com/Xilinx/linux-xlnx/blob/master/arch/arm/configs/xilinx_zynq_defconfig) I notice that the config you mention is not set. I will see if we can rebuild with CONFIG_USB_EHCI_TT_NEWSCHED=y added (I don't believe it is included in any of the succeeding patches).
G

@borine
Copy link
Collaborator

borine commented Aug 11, 2020

I do not have the file you mention

On some distributions, you can get the current kernel config from the configs module:

$ sudo modprobe configs
$ zgrep USB_EHCI_TT_NEWSCHED /proc/config.gz

On a raspberry pi, running Raspbian OS, I get:

$ zgrep USB_EHCI_TT_NEWSCHED /proc/config.gz
$ 

So that setting is not mentioned at all there, but the ASUS dongle still works correctly with HSP.

@grahamnaylorccfe
Copy link
Author

grahamnaylorccfe commented Aug 11, 2020

root@koheron:~# zgrep USB_EHCI_TT_NEWSCHED /proc/config.gz

CONFIG_USB_EHCI_TT_NEWSCHED is not set

@borine
Copy link
Collaborator

borine commented Aug 12, 2020

OK, so here's a strange thing. I have an atheros on-board USB BT adapter in my laptop, and SCO recording has never worked - sco RX bytes is always 0 just like you are seeing with the Cora board . However, the ASUS external USB adapter works fine on this laptop.

I came across a post suggesting that power-saving on a usb adapter can cause issues, so I turned it off by adding the following to my kernel command-line in the bootloader:
usbcore.autosuspend=-1

And now - SCO recording works 🍾 🎆

So, if the kernel config change makes no difference, it might be worth giving this module parameter a try.

@grahamnaylorccfe
Copy link
Author

@borine I think you are on the right track here!!!
zgrep USB_EHCI_TT_NEWSCHED /proc/config.gz
CONFIG_USB_EHCI_TT_NEWSCHED=y

Then tried the arecord and got a large .wav file. I then played it back with aplay and heard myself again. The sound was quite distorted - but at least we have some thing to work from.
cheers
Graham

@grahamnaylorccfe
Copy link
Author

Thanks so much @borine and @arkq for your help on this and especially your patience and commitment to solve this issue. I think we can consider the original issue of no recording as solved now. There is a residual issue of recording quality, but that I believe is covered in other issues and may be the configuration of the BT physical layer? The values recovered are 8 bit and all 7F or 80 (with the odd 81 and 82), but still remarkably recognisable as speech!

@grahamnaylorccfe
Copy link
Author

As an addendum, I can say that the quality of the recording is now good. I had been able to adjust the volume a little bit using such as:
amixer -D bluealsa sset 'BH-M6 - SCO' playback 70% capture 100%
but what really made the difference was switching to 16bit capture from the mic using for example:
arecord -f S16_LE -D bluealsa:SRV=org.bluealsa,DEV=00:6A:8E:16:DE:B4,PROFILE=sco recordboom_mic3.wav

Anyway - I am now a very happy user of BlueAlsa - thanks again guys!

@ssirig714
Copy link

ssirig714 commented Feb 14, 2022

Hi ,

HFP headphone connection success with bluealsa.
arecord is not working writing into test.wav file for qualcomm BT UART adaptor for HFP SCO .
hciconfig -a o/p sco count is showing zero .
Could you please help is it simialr issue or any fix we need to add for qualcomm like broadcomm route the sco?
from the bluealsa debugs did not see any error.

logs are :


uname -a

Linux 4.9.232-1.19 #1 SMP Tue Feb 1 23:20:16 UTC 2022 armv7l GNU/Linux

hciconfig -a

hci0: Type: Primary Bus: UART
BD Address: 61:47:AA:32:44:08 ACL MTU: 1024:7 SCO MTU: 60:8
UP RUNNING
RX bytes:54325 acl:404 sco:0 events:2229 errors:0
TX bytes:32952 acl:413 sco:0 commands:1180 errors:0
Features: 0xff 0xfe 0x8f 0xfe 0xd8 0x3f 0x5b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF
Link mode: SLAVE ACCEPT
Name: 'BlueZ 5.54'
Class: 0x480000
Service Classes: Capturing, Telephony
Device Class: Miscellaneous,
HCI Version: 4.2 (0x8) Revision: 0x0
LMP Version: 4.2 (0x8) Subversion: 0x25a
Manufacturer: Qualcomm (29)

#arecord -D bluealsa:DEV=11:11:22:33:80:72,PROFILE=sco /tmp/test.wav
D: ../../../git/src/asound/bluealsa-pcm.c:1312: Getting BlueALSA PCM: CAPTURE 11:11:22:33:80:72 sco
D: ../../../git/src/asound/bluealsa-pcm.c:1062: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Setting constraints
Recording WAVE '/tmp/test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
D: ../../../git/src/asound/bluealsa-pcm.c:532: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Initializing HW
bluealsa: D: ../../git/src/dbus.c:66: Called: org.bluealsa.PCM1.Open() on /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source
bluealsa: D: ../../git/src/ba-transport.c:711: New SCO link: 11:11:22:33:80:72: 28
bluealsa: D: ../../git/src/hci.c:133: SCO link socket MTU: 28: 60
bluealsa: D: ../../git/src/ba-transport.c:1151: Starting transport: HFP Audio Gateway (CVSD)
bluealsa: D: ../../git/src/ba-transport.c:294: Created BT socket duplicate: [28]: 29
bluealsa: D: ../../git/src/ba-transport.c:1472: Created new IO thread [ba-sco-enc]: HFP Audio Gateway (CVSD)
bluealsa: D: ../../git/src/ba-transport.c:294: Created BT socket duplicate: [28]: 30
bluealsa: D: ../../git/src/sco.c:230: IO loop: START: sco_cvsd_enc_thread: HFP Audio Gateway (CVSD)
bluealsa: D: ../../git/src/ba-transport.c:1472: Created new IO thread [ba-sco-dec]: HFP Audio Gateway (CVSD)
bluealsa: D: ../../git/src/sco.c:301: IO loop: START: sco_cvsd_dec_thread: HFP Audio Gateway (CVSD)
D: ../../../git/src/asound/bluealsa-pcm.c:567: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: FIFO buffer size: 32768 frames
D: ../../../git/src/asound/bluealsa-pcm.c:573: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Selected HW buffer: 4 periods x 2000 bytes == 8000 bytes
D: ../../../git/src/asound/bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Initializing SW
D: ../../../git/src/asound/bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Initializing SW
D: ../../../git/src/asound/bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Initializing SW
D: ../../../git/src/asound/bluealsa-pcm.c:639: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Prepared
D: ../../../git/src/asound/bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Initializing SW
D: ../../../git/src/asound/bluealsa-pcm.c:356: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Starting
bluealsa: D: ../../git/src/ba-transport.c:1387: PCM resumed: 25
D: ../../../git/src/asound/bluealsa-pcm.c:226: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Starting IO loop: 7
[ 851.338036] >>Open gpK7 (pid:14781 "RF4CE")
[ 852.289070] >>Close gpK7 (pid:14740 "controlMgr")
[ 858.584298] >>Open gpK7 (pid:15691 "RF4CE")
[ 859.534209] >>Close gpK7 (pid:15631 "controlMgr")
[ 865.731508] >>Open gpK7 (pid:16353 "RF4CE")
[ 866.668530] >>Close gpK7 (pid:16351 "controlMgr")
[ 872.925503] >>Open gpK7 (pid:19552 "RF4CE")
^CAborted by signal Interrupt...
arecord: pcm_read:2151: read error: Interrupted system call
D: ../../../git/src/asound/bluealsa-pcm.c:392: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Stopping
D: ../../../git/src/asound/bluealsa-pcm.c:161: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: IO thread cleanup
D: ../../../git/src/asound/bluealsa-pcm.c:592: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Freeing HW
D: ../../../git/src/asound/bluealsa-pcm.c:443: /org/bluealsa/hci0/dev_11_11_22_33_80_72/hfpag/source: Closing
bluealsa: D: ../../git/src/ba-transport.c:1434: Closing PCM: 25
bluealsa: D: ../../git/src/ba-transport.c:438: PCM clients check keep-alive: 0 ms
bluealsa: D: ../../git/src/ba-transport.c:387: Stopping transport: No PCM clients
bluealsa: D: ../../git/src/ba-transport.c:306: Closing BT socket duplicate [28]: 29
bluealsa: D: ../../git/src/ba-transport.c:726: Releasing SCO link: 28
bluealsa: D: ../../git/src/ba-transport.c:1497: Exiting IO thread [ba-sco-enc]: HFP Audio Gateway (CVSD)
bluealsa: D: ../../git/src/ba-transport.c:306: Closing BT socket duplicate [-1]: 30
bluealsa: D: ../../git/src/ba-transport.c:1497: Exiting IO thread [ba-sco-dec]: HFP Audio Gateway (CVSD)

ls -alr /tmp/test.wav

-rw-r--r-- 1 root root 44 Feb 14 12:21 /tmp/test.wav
root@tchxi6:/opt#
Same i have tried to aplay its not working .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants