mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-30 07:21:20 +00:00
only use hostname for daemon
This commit is contained in:
parent
43ed83b192
commit
93bcd4d016
@ -1876,6 +1876,8 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t * packet, uint
|
||||
}
|
||||
#endif
|
||||
|
||||
static char hostname[30];
|
||||
|
||||
int main (int argc, char * const * argv){
|
||||
|
||||
static int tcp_flag = 0;
|
||||
@ -1997,6 +1999,11 @@ int main (int argc, char * const * argv){
|
||||
// init HCI
|
||||
hci_init(transport, config, control, remote_device_db);
|
||||
|
||||
// hostname for POSIX systems
|
||||
gethostname(hostname, 30);
|
||||
hostname[29] = '\0';
|
||||
gap_set_local_name(hostname);
|
||||
|
||||
#ifdef HAVE_PLATFORM_IPHONE_OS
|
||||
// iPhone doesn't use SSP yet as there's no UI for it yet and auto accept is not an option
|
||||
hci_ssp_set_enable(0);
|
||||
|
16
src/hci.c
16
src/hci.c
@ -1046,18 +1046,12 @@ static void hci_initializing_run(void){
|
||||
if (hci_stack->local_name){
|
||||
hci_send_cmd(&hci_write_local_name, hci_stack->local_name);
|
||||
} else {
|
||||
char hostname[30];
|
||||
#ifdef EMBEDDED
|
||||
char local_name[30];
|
||||
// BTstack-11:22:33:44:55:66
|
||||
strcpy(hostname, "BTstack ");
|
||||
strcat(hostname, bd_addr_to_str(hci_stack->local_bd_addr));
|
||||
log_info("---> Name %s", hostname);
|
||||
#else
|
||||
// hostname for POSIX systems
|
||||
gethostname(hostname, 30);
|
||||
hostname[29] = '\0';
|
||||
#endif
|
||||
hci_send_cmd(&hci_write_local_name, hostname);
|
||||
strcpy(local_name, "BTstack ");
|
||||
strcat(local_name, bd_addr_to_str(hci_stack->local_bd_addr));
|
||||
log_info("---> Name %s", local_name);
|
||||
hci_send_cmd(&hci_write_local_name, local_name);
|
||||
}
|
||||
break;
|
||||
case HCI_INIT_WRITE_SCAN_ENABLE:
|
||||
|
Loading…
x
Reference in New Issue
Block a user