/usr/include/ubertooth/ubertooth_interface.h is in libubertooth-dev 2017.03.R2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | /*
* Copyright 2012 Dominic Spill
*
* This file is part of Project Ubertooth.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef __UBERTOOTH_INTERFACE_H
#define __UBERTOOTH_INTERFACE_H
#include <stdint.h>
// increment on every API change
#define UBERTOOTH_API_VERSION 0x0102
#define DMA_SIZE 50
#define NUM_BREDR_CHANNELS 79
/*
* CLK_TUNE_TIME is the duration in units of 100 ns that we reserve for tuning
* the radio while frequency hopping. We start the tuning process
* CLK_TUNE_TIME * 100 ns prior to the start of an upcoming time slot.
*/
#define CLK_TUNE_TIME 2250
#define CLK_TUNE_OFFSET 200
enum ubertooth_usb_commands {
UBERTOOTH_PING = 0,
UBERTOOTH_RX_SYMBOLS = 1,
UBERTOOTH_TX_SYMBOLS = 2,
UBERTOOTH_GET_USRLED = 3,
UBERTOOTH_SET_USRLED = 4,
UBERTOOTH_GET_RXLED = 5,
UBERTOOTH_SET_RXLED = 6,
UBERTOOTH_GET_TXLED = 7,
UBERTOOTH_SET_TXLED = 8,
UBERTOOTH_GET_1V8 = 9,
UBERTOOTH_SET_1V8 = 10,
UBERTOOTH_GET_CHANNEL = 11,
UBERTOOTH_SET_CHANNEL = 12,
UBERTOOTH_RESET = 13,
UBERTOOTH_GET_SERIAL = 14,
UBERTOOTH_GET_PARTNUM = 15,
UBERTOOTH_GET_PAEN = 16,
UBERTOOTH_SET_PAEN = 17,
UBERTOOTH_GET_HGM = 18,
UBERTOOTH_SET_HGM = 19,
UBERTOOTH_TX_TEST = 20,
UBERTOOTH_STOP = 21,
UBERTOOTH_GET_MOD = 22,
UBERTOOTH_SET_MOD = 23,
UBERTOOTH_SET_ISP = 24,
UBERTOOTH_FLASH = 25,
BOOTLOADER_FLASH = 26,
UBERTOOTH_SPECAN = 27,
UBERTOOTH_GET_PALEVEL = 28,
UBERTOOTH_SET_PALEVEL = 29,
UBERTOOTH_REPEATER = 30,
UBERTOOTH_RANGE_TEST = 31,
UBERTOOTH_RANGE_CHECK = 32,
UBERTOOTH_GET_REV_NUM = 33,
UBERTOOTH_LED_SPECAN = 34,
UBERTOOTH_GET_BOARD_ID = 35,
UBERTOOTH_SET_SQUELCH = 36,
UBERTOOTH_GET_SQUELCH = 37,
UBERTOOTH_SET_BDADDR = 38,
UBERTOOTH_START_HOPPING = 39,
UBERTOOTH_SET_CLOCK = 40,
UBERTOOTH_GET_CLOCK = 41,
UBERTOOTH_BTLE_SNIFFING = 42,
UBERTOOTH_GET_ACCESS_ADDRESS = 43,
UBERTOOTH_SET_ACCESS_ADDRESS = 44,
UBERTOOTH_DO_SOMETHING = 45,
UBERTOOTH_DO_SOMETHING_REPLY = 46,
UBERTOOTH_GET_CRC_VERIFY = 47,
UBERTOOTH_SET_CRC_VERIFY = 48,
UBERTOOTH_POLL = 49,
UBERTOOTH_BTLE_PROMISC = 50,
UBERTOOTH_SET_AFHMAP = 51,
UBERTOOTH_CLEAR_AFHMAP = 52,
UBERTOOTH_READ_REGISTER = 53,
UBERTOOTH_BTLE_SLAVE = 54,
UBERTOOTH_GET_COMPILE_INFO = 55,
UBERTOOTH_BTLE_SET_TARGET = 56,
UBERTOOTH_BTLE_PHY = 57,
UBERTOOTH_WRITE_REGISTER = 58,
UBERTOOTH_JAM_MODE = 59,
UBERTOOTH_EGO = 60,
UBERTOOTH_AFH = 61,
UBERTOOTH_HOP = 62,
UBERTOOTH_TRIM_CLOCK = 63,
// UBERTOOTH_GET_API_VERSION = 64,
UBERTOOTH_WRITE_REGISTERS = 65,
UBERTOOTH_READ_ALL_REGISTERS = 66,
UBERTOOTH_RX_GENERIC = 67,
UBERTOOTH_TX_GENERIC_PACKET = 68,
UBERTOOTH_FIX_CLOCK_DRIFT = 69,
};
enum jam_modes {
JAM_NONE = 0,
JAM_ONCE = 1,
JAM_CONTINUOUS = 2,
};
enum modulations {
MOD_BT_BASIC_RATE = 0,
MOD_BT_LOW_ENERGY = 1,
MOD_80211_FHSS = 2,
MOD_NONE = 3
};
enum usb_pkt_types {
BR_PACKET = 0,
LE_PACKET = 1,
MESSAGE = 2,
KEEP_ALIVE = 3,
SPECAN = 4,
LE_PROMISC = 5,
EGO_PACKET = 6,
};
enum hop_mode {
HOP_NONE = 0,
HOP_SWEEP = 1,
HOP_BLUETOOTH = 2,
HOP_BTLE = 3,
HOP_DIRECT = 4,
HOP_AFH = 5,
};
enum usb_pkt_status {
DMA_OVERFLOW = 0x01,
DMA_ERROR = 0x02,
FIFO_OVERFLOW = 0x04,
CS_TRIGGER = 0x08,
RSSI_TRIGGER = 0x10,
DISCARD = 0x20,
};
/*
* USB packet for Bluetooth RX (64 total bytes)
*/
typedef struct {
u8 pkt_type;
u8 status;
u8 channel;
u8 clkn_high;
u32 clk100ns;
int8_t rssi_max; // Max RSSI seen while collecting symbols in this packet
int8_t rssi_min; // Min ...
int8_t rssi_avg; // Average ...
u8 rssi_count; // Number of ... (0 means RSSI stats are invalid)
u8 reserved[2];
u8 data[DMA_SIZE];
} usb_pkt_rx;
typedef struct {
u64 address;
u64 syncword;
} bdaddr;
typedef struct {
u8 valid;
u8 request_pa;
u8 request_num;
u8 reply_pa;
u8 reply_num;
} rangetest_result;
typedef struct {
u16 synch;
u16 syncl;
u16 channel;
u8 length;
u8 pa_level;
u8 data[DMA_SIZE];
} generic_tx_packet;
#endif /* __UBERTOOTH_INTERFACE_H */
|