bccmd Command in Linux



The bccmd command is a robust utility for interacting with Cambridge Silicon Radio (CSR) devices. This command allows you to issue BlueCore commands to these devices.

CRA is a multinational fabless semiconductor company headquartered in Cambridge, United Kingdom. CSR specializes in creating connectivity, audio, imaging, and location chips. Their portfolio included solutions for Bluetooth, GPS, FM broadcasting, Wi-Fi, and more.

The bccmd utility lets you communicate with CSR devices and perform multiple tasks. If you run it without specifying a <command>, it displays a short help page.

Table of Contents

Here is a comprehensive guide to the options available with the bccmd command −

Syntax for bccmd Command in Linux

The following is the general syntax for the bccmd command −

bccmd [-t <transport>] [-d <device>] <command> [<args>]

Different Options Available for the bccmd Command

The following are various options to use with the bccmd command for configuring the transport and specifying the device to operate on.

Tag Description
-t <transport>

This flag allows you to specify the communication transport. The valid options are −

HCI − Refers to the local device with Host Controller Interface (usually the default).

USB − Used for direct USB connections.

BCSP − Stands for Blue Core Serial Protocol.

H4 − Represents the H4 serial protocol.

3WIRE − Although not implemented, it refers to the 3WIRE protocol.

-d <dev> With this flag, you can specify a particular device to operate on. If you dont provide a device, the default behavior is to use the first available HCI device or /dev/ttyS0 for serial transports.

Various Commands to use with the bccmd Utility

The following are different commands you can use with bccmd utility to perform various tasks.

Tag Description
builddef Retrieves build definitions
keylen <handle> Gets the current cryptographic key length.
clock Retrieves the local Bluetooth clock
rand Generates a random number.
buildname Retrieves the full build name.
panicarg Gets the panic code argument.
faultarg Gets the fault code argument.
coldreset Performs a cold reset.
warmreset Performs a warm reset.
disabletx Disables transmission (TX) on the device.
enabletx Enables transmission (TX) on the device.
Singlechan <channel> Locks the radio on a specific channel.
hoppingon Reverts to channel hopping.
rttxdata1 <decimal freq MHz> <level> Conducts a TXData1 radio test.
memtypes Get memory types
psget [-r] [-s <stores>] <key> Retrieves the value for a PS key. The -r flag sends a warm reset afterward.
psset [-r] [-s <stores>] <key> <value> Sets the value for a PS key. The -r flag sends a warm reset afterward.
psclr [-r] [-s <stores>] <key> Clears the value for a PS key. The -r flag sends a warm reset afterward.
pslist [-r] [-s <stores>] Lists all PS keys. The -r flag sends a warm reset afterward.
psread [-r] [-s <stores>] Reads all PS keys. The -r flag sends a warm reset afterward.
psload [-r] [-s <stores>] <file> Loads all PS keys from a PSR file. The -r flag sends a warm reset afterward.
pscheck [-r] [-s <stores>] <file> Checks the syntax of a PSR file. The -r flag sends a warm reset afterward.

Examples of bccmd Command in Linux

In this section, we'll explore some examples of using the bccmd command, along with its options and other commands −

Build Definitions

To get build definitions, use the following syntax −

bccmd builddef

Retrieve Cryptographic Key Length

To retrieve the current cryptographic key length, use the following syntax −

bccmd -t HCI -d /dev/ttyS0 keylen 7

Replace <7> with your actual handle value −

To identify you're handle value, you can use the following command to list active connections and their handles −

hcitool con

Fetch Local Bluetooth Clock

To fetch the local Bluetooth clock, run the following command −

bccmd -t USB clock

Retrieve a PS Key Value

To get the value of a specific PS key, run the following command −

bccmd -t H4 psget bd_addr

Replace <bd_addr> with the specific key you want to query.

Get Chip Revision

To retrieve the chip revision using the bccmd tool, use the following syntax −

bccmd -t HCI chiprev

Generate Random Number

Creating random numbers is crucial for creating secure encryption keys cryptographic algorithms also rely on unpredictable random numbers to enhance security.

To generate a random number, use the following command −

bccmd -t BCSP rand

Retrieve Full Build Name

To get the full build name, run −

bccmd buildname

This command provides you with the complete build name associated with the CSR device youre working with.

Get Panic Code Argument

To retrieve the panic code argument, you can run the following command −

bccmd panicarg

Get Fault Code Argument

To retrieve the fault code argument, you can use the following syntax −

bccmd faultarg

Perform a Cold Reset

To perform a cold reset, you can simply use the following syntax −

bccmd coldreset

This will initiate a cold reset on the Cambridge Silicon Radio (CSR) device.

Perform a Warm Reset

To perform a warm reset, you can use the following syntax −

bccmd warmreset

This will initiate a warm reset on the Cambridge Silicon Radio (CSR) device.

Enable TX on the Device

To enable transmission (TX) on your device, you can use the following syntax −

bccmd enabletx

TX is the process of transmitting data from one device (such as a Bluetooth module) to another. When TX is enabled, your device actively sends out signals.

Disable TX on the device

To disable transmission (TX) on your device, you can use the following command −

bccmd disabletx

By using this command, you instruct your device to turn off its transmission capability. Essentially, it stops sending data over the airwaves.

Lock radio on a specific channel

To lock the radio on a specific channel, you can simply run the following command −

bccmd singlechan  32

Replace <32> with your desired channel number.

Set Value for PS Key

To set a value for a PS key, use the following syntax −

bccmd psset -r -s main my_key 120

Replace <my-key> and <120> with your actual values.

Clear value for PS key

To clear the value for a PS key, you can simply use the following syntax −

bccmd psclr -r -s main my_key

TXData1 radio test

To perform the TXData1 radio test, specify the decimal frequency in megahertz and the desired transmission level. For instance −

bccmd rttxdata1 2452 10

Conclusion

These are some of the operations you can perform with the bccmd utility. However, take into account that usage may vary based on your specific requirements and the CSR device youre working with.

Advertisements