posix-h4: allow to set fallback random address for nRF5340 via command line

This commit is contained in:
Matthias Ringwald 2024-03-14 15:36:31 +01:00
parent 1c61f11625
commit e28aaf35e2

View File

@ -89,7 +89,7 @@ static btstack_tlv_posix_t tlv_context;
static bd_addr_t static_address; static bd_addr_t static_address;
// random MAC address for the device, used if nothing else is available // random MAC address for the device, used if nothing else is available
static const bd_addr_t random_address = { 0xC1, 0x01, 0x01, 0x01, 0x01, 0x01 }; static bd_addr_t random_address = { 0xC1, 0x01, 0x01, 0x01, 0x01, 0x01 };
static int is_bcm; static int is_bcm;
// shutdown // shutdown
@ -281,13 +281,14 @@ static void local_version_information_handler(uint8_t * packet){
} }
} }
static char short_options[] = "hu:l:r"; static char short_options[] = "hu:l:rb:";
static struct option long_options[] = { static struct option long_options[] = {
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"logfile", required_argument, NULL, 'l'}, {"logfile", required_argument, NULL, 'l'},
{"reset-tlv", no_argument, NULL, 'r'}, {"reset-tlv", no_argument, NULL, 'r'},
{"tty", required_argument, NULL, 'u'}, {"tty", required_argument, NULL, 'u'},
{"bd-addr", required_argument, NULL, 'b'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@ -296,6 +297,7 @@ static char *help_options[] = {
"set file to store debug output and HCI trace.", "set file to store debug output and HCI trace.",
"reset bonding information stored in TLV.", "reset bonding information stored in TLV.",
"set path to Bluetooth Controller.", "set path to Bluetooth Controller.",
"set random static Bluetooth address for nRF5340 with PacketCraft Controller.",
}; };
static char *option_arg_name[] = { static char *option_arg_name[] = {
@ -303,6 +305,7 @@ static char *option_arg_name[] = {
"LOGFILE", "LOGFILE",
"", "",
"TTY", "TTY",
"BD_ADDR",
}; };
static void usage(const char *name){ static void usage(const char *name){
@ -340,6 +343,9 @@ int main(int argc, const char * argv[]){
case 'r': case 'r':
tlv_reset = true; tlv_reset = true;
break; break;
case 'b':
sscanf_bd_addr(optarg, random_address);
break;
case 'h': case 'h':
default: default:
usage(argv[0]); usage(argv[0]);