Skip to contentSkip to conversation

Hardware interface constant for Bluetooth

PATCH Marcel Holtmann 2 participants 7 messages Nov 8, 2004 – Nov 9, 2004 Sound

lore
Share & tools
lore
#0 lore raw

Hi guys,

I like to drive the Bluetooth audio support a little bit and it would be great if you can add a hardware interface constant for us. I don't know what is the correct procedure to do it, but from my first analysis it seems that it is enough to add a patch like the one below to the kernel code and the library code. Everything else can be developed outside the ALSA core.

===== include/sound/asound.h 1.30 vs edited =====

include/sound/asound.h 2004-11-08 02:12:44 +01:00 renamed from include/sound/asound.h 2004-09-03 11:08:15 +02:00 +2 -1
@@ -110,9 +110,10 @@
        SNDRV_HWDEP_IFACE_MIXART,       /* Digigram miXart cards */
        SNDRV_HWDEP_IFACE_USX2Y,        /* Tascam US122, US224 & US428 usb */
        SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
+       SNDRV_HWDEP_IFACE_BLUETOOTH,    /* Bluetooth audio */
 
        /* Don't forget to change the following: */
-       SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_EMUX_WAVETABLE,
+       SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_BLUETOOTH,
 };
 
 struct sndrv_hwdep_info {

Regards

Marcel

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click

#1 lore raw
Quoted 10 lines · Marcel Holtmann

Hi guys,

I like to drive the Bluetooth audio support a little bit and it would be great if you can add a hardware interface constant for us. I don't know what is the correct procedure to do it, but from my first analysis it seems that it is enough to add a patch like the one below to the kernel code and the library code. Everything else can be developed outside the ALSA core.

+ SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */

Do you need really this change? This identifier is only used for hardware independent API (hwdep) - mostly for firmware / DSP code handling and other things which don't fall into abstract APIs.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click

#2 lore raw

Hi Jaroslav,

Quoted 7 lines
Quoted 7 lines

I like to drive the Bluetooth audio support a little bit and it would be great if you can add a hardware interface constant for us. I don't know what is the correct procedure to do it, but from my first analysis it seems that it is enough to add a patch like the one below to the kernel code and the library code. Everything else can be developed outside the ALSA core.

Quoted 5 lines
Quoted 1 line

+ SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */

Do you need really this change? This identifier is only used for hardware independent API (hwdep) - mostly for firmware / DSP code handling and other things which don't fall into abstract APIs.

this is a little bit tricky. Besides the native support for transporting PCM data over a Bluetooth SCO channel, the headset/handsfree profile uses a RFCOMM channel (serial port emulation) for additional settings. On this channel they use AT commands and actually I don't wanna put a AT parser into the kernel. It is in somekind possible, but I still think that it does not belong there, because it is profile specific and a Bluetooth profile is an application and applications should run in user space. On the other hand you still need to create that SCO channel from user space with somekind of ioctl, because the kernel can't know when this channel must be established. It depends on some AT commands that are send over the RFCOMM channel.

So my plan is to write a kernel module that is reponsible for the SCO audio traffic. This registers as a soundcard with the ALSA subsystem and it also registers a Bluetooth HWDEP. There is no initial PCM device registered with this soundcard. These are only added when a SCO channel is opened from the peer side or requested through an ioctl on the HWDEP interface. Besides this the HWDEP would also control the mixer settings, because these are exchanged over the RFCOMM channel.

Do you think this makes sense?

Regards

Marcel

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click

#3 lore raw
Quoted 20 lines · Marcel Holtmann

this is a little bit tricky. Besides the native support for transporting PCM data over a Bluetooth SCO channel, the headset/handsfree profile uses a RFCOMM channel (serial port emulation) for additional settings. On this channel they use AT commands and actually I don't wanna put a AT parser into the kernel. It is in somekind possible, but I still think that it does not belong there, because it is profile specific and a Bluetooth profile is an application and applications should run in user space. On the other hand you still need to create that SCO channel from user space with somekind of ioctl, because the kernel can't know when this channel must be established. It depends on some AT commands that are send over the RFCOMM channel.

So my plan is to write a kernel module that is reponsible for the SCO audio traffic. This registers as a soundcard with the ALSA subsystem and it also registers a Bluetooth HWDEP. There is no initial PCM device registered with this soundcard. These are only added when a SCO channel is opened from the peer side or requested through an ioctl on the HWDEP interface. Besides this the HWDEP would also control the mixer settings, because these are exchanged over the RFCOMM channel.

Quoted 1 line

Do you think this makes sense?

Yep, the management of PCM devices belongs into the hwdep API - except the mixer controls. You should map the possible mixer and other controls using the universal control API.

The SNDRV_HWDEP_IFACE_BLUETOOTH definition was added to the ALSA CVS tree.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click

#4 lore raw

Hi Jaroslav,

Quoted 20 lines
Quoted 20 lines

this is a little bit tricky. Besides the native support for transporting PCM data over a Bluetooth SCO channel, the headset/handsfree profile uses a RFCOMM channel (serial port emulation) for additional settings. On this channel they use AT commands and actually I don't wanna put a AT parser into the kernel. It is in somekind possible, but I still think that it does not belong there, because it is profile specific and a Bluetooth profile is an application and applications should run in user space. On the other hand you still need to create that SCO channel from user space with somekind of ioctl, because the kernel can't know when this channel must be established. It depends on some AT commands that are send over the RFCOMM channel.

So my plan is to write a kernel module that is reponsible for the SCO audio traffic. This registers as a soundcard with the ALSA subsystem and it also registers a Bluetooth HWDEP. There is no initial PCM device registered with this soundcard. These are only added when a SCO channel is opened from the peer side or requested through an ioctl on the HWDEP interface. Besides this the HWDEP would also control the mixer settings, because these are exchanged over the RFCOMM channel.

Quoted 7 lines
Quoted 1 line

Do you think this makes sense?

Yep, the management of PCM devices belongs into the hwdep API - except the mixer controls. You should map the possible mixer and other controls using the universal control API.

The SNDRV_HWDEP_IFACE_BLUETOOTH definition was added to the ALSA CVS tree.

I will look at the universal control API when the basics of the PCM handling are done. Thanks.

Regards

Marcel

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click

#5 lore raw
In reply to Jaroslav Kysela

Hi Jaroslav,

Quoted 1 line

The SNDRV_HWDEP_IFACE_BLUETOOTH definition was added to the ALSA CVS tree.

I checked the CVS HEAD version of the ALSA library and I think it must be added there too. Is this correct or is there another way you keep these in sync between the kernel and the userspace? Looking at the file "include/hwdep.h", I realized that the previous entry for the "EmuX wavetable" is also missing.

Regards

Marcel

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click

#6 lore raw
Quoted 9 lines · Marcel Holtmann

Hi Jaroslav,

Quoted 1 line

The SNDRV_HWDEP_IFACE_BLUETOOTH definition was added to the ALSA CVS tree.

I checked the CVS HEAD version of the ALSA library and I think it must be added there too. Is this correct or is there another way you keep these in sync between the kernel and the userspace? Looking at the file "include/hwdep.h", I realized that the previous entry for the "EmuX wavetable" is also missing.

Thanks. Fixed now.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click