# Possibility to use HSP bluetooth profile.



## Anatoly_kch (Jan 25, 2022)

I've got cheap bluetooth headset. A2DP stereo plays flawlessly through VirtualOSS, but I want working microphone too. As I can understand from what Windows shows, this headset supports only HSP for mic, while VirtuallOSS supports A2DP only. So when I attempt to attach VirtualOSS to mic (-R /dev/bluetooth/...) it shows repeatedly:

```
backend_bt: PSM=0xffffffff
backend_bt: PSM not found
```
What is "PSM" btw?
 Hence my questions:
Is there any at least half-ready solution fo HSP?
If no, can anyone point to some good docs/sources to start digging into HSP-related part of BT stack? At a quick look thing is complex and there is few very scattered information on this. To me looks like HSP uses even different type of connection than A2DP or serial-over-bt? Honestly, I even didn't get how to list/search available profiles with `sdpcontrol`

```
# sdpcontrol -a XX:XX:XX:XX:XX:XX browse

Record Handle: 0x00010000
Service Class ID List:
        Browse Group Descriptor (0x1001)

Record Handle: 0x00010005
Service Class ID List:
        Human Interface Device (0x1124)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 17
        HIDP (0x0011)
Bluetooth Profile Descriptor List:
        Human Interface Device (0x1124) ver. 1.0

Record Handle: 0x00010006
Service Class ID List:
        PNP Information (0x1200)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 1
        SDP (0x0001)
Bluetooth Profile Descriptor List:
        PNP Information (0x1200) ver. 1.0
```

and
`#  sppcontrol -a <...> search HSET`
also doesn't return anything about that.


----------



## Anatoly_kch (Jan 26, 2022)

so far I came across
/usr/include/sdp.h
which has definition of "Service class IDs"

```
#!/bin/sh

svcs="1000 1001 1002 1101 1102 1103 1104 1105 1106 1107 1108 1109 110A 110B 110C 110D 110E 110F 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 111A 111B 111C 111D 111E 111F 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 112A 112B 112C 112D 112E 112F 1130 1200 1201 1202 1203 1204 1205 1206 1300 1301 1302 1303 1304 1305"

for svc in $svcs
do
 echo "testing $svc"
 sdpcontrol -a XX:XX:XX:XX:XX:XX search $svc
done
```

Which returns:


```
testing 1000

Record Handle: 00000000
Service Class ID List:
        Service Discovery Server (0x1000)
testing 1001

Record Handle: 0x00010000
Service Class ID List:
        Browse Group Descriptor (0x1001)
testing 1002

Record Handle: 0x00010000
Service Class ID List:
        Browse Group Descriptor (0x1001)

Record Handle: 0x00010005
Service Class ID List:
        Human Interface Device (0x1124)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 17
        HIDP (0x0011)
Bluetooth Profile Descriptor List:
        Human Interface Device (0x1124) ver. 1.0

Record Handle: 0x00010006
Service Class ID List:
        PNP Information (0x1200)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 1
        SDP (0x0001)
Bluetooth Profile Descriptor List:
        PNP Information (0x1200) ver. 1.0
testing 1101
testing 1102
testing 1103
testing 1104
testing 1105
testing 1106
testing 1107
testing 1108
testing 1109
testing 110A
testing 110B

Record Handle: 0x00010002
Service Class ID List:
        Audio Sink (0x110b)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 25
        AVDTP (0x0019)
                Protocol specific parameter #1: u/int/uuid16 258
Bluetooth Profile Descriptor List:
        Advanced Audio Distribution (0x110d) ver. 1.2
testing 110C

Record Handle: 0x00010004
Service Class ID List:
        A/V Remote Control Target (0x110c)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 23
        AVCTP (0x0017)
                Protocol specific parameter #1: u/int/uuid16 260
Bluetooth Profile Descriptor List:
        A/V Remote Control (0x110e) ver. 1.5
testing 110D

Record Handle: 0x00010002
Service Class ID List:
        Audio Sink (0x110b)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 25
        AVDTP (0x0019)
                Protocol specific parameter #1: u/int/uuid16 258
Bluetooth Profile Descriptor List:
        Advanced Audio Distribution (0x110d) ver. 1.2
testing 110E

Record Handle: 0x00010003
Service Class ID List:
        A/V Remote Control (0x110e)
        Video Conferencing (0x110f)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 23
        AVCTP (0x0017)
                Protocol specific parameter #1: u/int/uuid16 260
Bluetooth Profile Descriptor List:
        A/V Remote Control (0x110e) ver. 1.5

Record Handle: 0x00010004
Service Class ID List:
        A/V Remote Control Target (0x110c)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 23
        AVCTP (0x0017)
                Protocol specific parameter #1: u/int/uuid16 260
Bluetooth Profile Descriptor List:
        A/V Remote Control (0x110e) ver. 1.5
testing 110F

Record Handle: 0x00010003Service Class ID List:
        A/V Remote Control (0x110e)
        Video Conferencing (0x110f)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 23
        AVCTP (0x0017)
                Protocol specific parameter #1: u/int/uuid16 260
Bluetooth Profile Descriptor List:
        A/V Remote Control (0x110e) ver. 1.5
testing 1110
testing 1111
testing 1112
testing 1113
testing 1114
testing 1115
testing 1116
testing 1117
testing 1118
testing 1119
testing 111A
testing 111B
testing 111C
testing 111D
testing 111E

Record Handle: 0x00010001
Service Class ID List:
        Handsfree (0x111e)
        Generic Audio (0x1203)
Protocol Descriptor List:
        L2CAP (0x0100)
        RFCOMM (0x0003)
                Protocol specific parameter #1: u/int8/bool 1
Bluetooth Profile Descriptor List:
        Handsfree (0x111e) ver. 1.5
testing 111F
testing 1120
testing 1121
testing 1122
testing 1123
testing 1124

Record Handle: 0x00010005
Service Class ID List:
        Human Interface Device (0x1124)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 17
        HIDP (0x0011)
Bluetooth Profile Descriptor List:
        Human Interface Device (0x1124) ver. 1.0
testing 1125
testing 1126
testing 1127
testing 1128
testing 1129
testing 112A
testing 112B
testing 112C
testing 112D
testing 112E
testing 112F
testing 1130
testing 1200

Record Handle: 0x00010006
Service Class ID List:
        PNP Information (0x1200)
Protocol Descriptor List:
        L2CAP (0x0100)
                Protocol specific parameter #1: u/int/uuid16 1
        SDP (0x0001)
Bluetooth Profile Descriptor List:
        PNP Information (0x1200) ver. 1.0
testing 1201
testing 1202
testing 1203

Record Handle: 0x00010001
Service Class ID List:
        Handsfree (0x111e)
        Generic Audio (0x1203)
Protocol Descriptor List:
        L2CAP (0x0100)
        RFCOMM (0x0003)
                Protocol specific parameter #1: u/int8/bool 1
Bluetooth Profile Descriptor List:
        Handsfree (0x111e) ver. 1.5
testing 1204
testing 1205
testing 1206
testing 1300
testing 1301
testing 1302
testing 1303
testing 1304
testing 1305
```

Also I've found this python project based on PyBlues library, which in turn depends on libbluetooth. While we have libbluettooth, PyBlues won't compile as is.
https://github.com/Nikolay-Kha/BluetoothAudio:


> This project shows how to capture and play audio with bluetooth HSP/HFP device without pulseaudio or any other sound sy1stem


Currently I looking trougt it's code and trying to poke into VirtuallOSS code, but still have no clue how to deal with bluetooth stack...


----------

