Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SCO loopback in bluetooth [closed]

Description:

I have a small in-house device with bluetooth capabilities. At the moment , other devices connect to that box. we play music in our box and via bluetooth we stream it on connected devices. we use " aplay -D btheadset " command to play music.

Requirement:
I want to know what i sco loopback? and how to check if my bluetooth supports it?

My investigation:
what I know is that we can stream music either via SCO link or ACL. how would i make sure its SCO? I havnt got any idea related to loopback.

Additional Information: The application uses Bluez libraires to send command to firmware/hardware and we extensively use HCItool.

Operating system : Fedora.

Any help will be beneficial to us. Thanks

like image 969
samprat Avatar asked Feb 02 '26 13:02

samprat


1 Answers

SCO stands for Synchronous Connection Oriented. An SCO link was primarily designed for audio, and provides dedicated time slots for packets to arrive. This is what makes it suitable for audio (Remember - BT is packet based transmission).

SCO Loopback is, for want of a better description, a device playing audio to itself. By it's very nature, I doubt that this would be possible. I think, however, what you want is an SCO link.

Now, when a device initiates an SCO connection with another, it must first initiate the connection by sending ACL packets. This is to make both devices aware of each other.

ACL is master-slave oriented. This means that neither device expects a packet in any particular frame.

Now, as for ensuring play in SCO mode:
This is very likely already the case. Now that we are using higher quality audio, BT devices have become very dependant on a constant stream of packets at regular intervals. An SCO link is a good way of ensuring this.

Edit: This is a test for SCO. Any devices that don't support it will be skipped.
Edit2: In Fedora, disable <*>SCO links support (CONFIG_BT_SCO) (I'm sorry, I don't know the parameter in Fedora to disable) and see if your working device now fails.

As for passing audio files to and from the device, is the device capable of playing it's own audio? If so, mount it as a USB device (Remember, Bluetooth uses the USB bus(I think))

Emerge or apt-get bluez-utils and obexfs. Should pull all the other libs as dependencies.

#emerge bluez-utils obexfs

modify /etc/bluetooth/hcid.conf like so

options {
autoinit yes"
security user
pairing multi
pin_helper /usr/bin/bluepin
}
device {
name testname
class 0x3e0100
iscan enable
pscan enable
lm accept
lp rswitch,hold,sniff,park 
}

Load the modules:

# modprobe fuse
# modprobe bluetooth
# modprobe ehci-hcd
# modprobe uhci-hcd
# modprobe hci_usb
# modprobe l2cap
# modprobe rfcomm

Activate BT, start, and get the MAC of the device

# echo enable >/proc/acpi/ibm/bluetooth
# /etc/init.d/bluetooth start
# hcitool scan

And mount your device:

# mkdir /mnt/player
# mount -t fuse "obexfs#-b<MAC address> -B6" /mnt/player

If you want a more user-friendly interface, try launching
kbtobexclient
And in the Location put
obex://[00:01:02:03:04:05]

I hope this meets your requirements.

like image 75
Wolfish Avatar answered Feb 05 '26 07:02

Wolfish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!