renamed log_err into log_error

This commit is contained in:
matthias.ringwald 2011-07-22 18:34:18 +00:00
parent 7b5fbe1fe3
commit 7d67539f26
14 changed files with 58 additions and 58 deletions

View File

@ -461,7 +461,7 @@ static int iphone_on (void *transport_config){
close(fd);
} else {
// no way!
log_err( "bt_control.c:iphone_on(): Failed to open '%s', trying killall %s\n", hci_uart_config->device_name, bluetool);
log_error( "bt_control.c:iphone_on(): Failed to open '%s', trying killall %s\n", hci_uart_config->device_name, bluetool);
system("killall -9 BlueToolH4");
system("killall -9 BlueTool");
sleep(3);
@ -471,7 +471,7 @@ static int iphone_on (void *transport_config){
if (fd > 0){
close(fd);
} else {
log_err( "bt_control.c:iphone_on(): Failed to open '%s' again, trying killall BTServer and killall %s\n", hci_uart_config->device_name, bluetool);
log_error( "bt_control.c:iphone_on(): Failed to open '%s' again, trying killall BTServer and killall %s\n", hci_uart_config->device_name, bluetool);
system("killall -9 BTServer");
system("killall -9 BlueToolH4");
system("killall -9 BlueTool");

View File

@ -290,7 +290,7 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
break;
default:
//@TODO: log into hci dump as vendor specific "event"
log_err("Error: command %u not implemented\n:", READ_CMD_OCF(packet));
log_error("Error: command %u not implemented\n:", READ_CMD_OCF(packet));
break;
}
return 0;
@ -613,7 +613,7 @@ int main (int argc, char * const * argv){
// make stdout unbuffered
setbuf(stdout, NULL);
log_err("BTdaemon started\n");
log_error("BTdaemon started\n");
// handle CTRL-c
signal(SIGINT, daemon_sigint_handler);

View File

@ -40,7 +40,7 @@
#ifdef EMBEDDED
#define log_info(...)
#define log_err(...)
#define log_error(...)
#define log_info(...)
#else
@ -49,6 +49,6 @@
#define log_info(format, ...) printf(format, ## __VA_ARGS__)
#define log_info(format, ...) printf(format, ## __VA_ARGS__)
#define log_err(format, ...) printf(format, ## __VA_ARGS__)
#define log_error(format, ...) printf(format, ## __VA_ARGS__)
#endif

View File

@ -184,7 +184,7 @@ static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size){
uint8_t hci_number_outgoing_packets(hci_con_handle_t handle){
hci_connection_t * connection = connection_for_handle(handle);
if (!connection) {
log_err("hci_number_outgoing_packets connectino for handle %u does not exist!\n", handle);
log_error("hci_number_outgoing_packets connectino for handle %u does not exist!\n", handle);
return 0;
}
return connection->num_acl_packets_sent;
@ -196,7 +196,7 @@ uint8_t hci_number_free_acl_slots(){
for (it = (linked_item_t *) hci_stack.connections; it ; it = it->next){
hci_connection_t * connection = (hci_connection_t *) it;
if (free_slots < connection->num_acl_packets_sent) {
log_err("hci_number_free_acl_slots: sum of outgoing packets > total acl packets!\n");
log_error("hci_number_free_acl_slots: sum of outgoing packets > total acl packets!\n");
return 0;
}
free_slots -= connection->num_acl_packets_sent;
@ -258,7 +258,7 @@ static void acl_handler(uint8_t *packet, int size){
// ignore non-registered handle
if (!conn){
log_err( "hci.c: acl_handler called with non-registered handle %u!\n" , con_handle);
log_error( "hci.c: acl_handler called with non-registered handle %u!\n" , con_handle);
return;
}
@ -272,7 +272,7 @@ static void acl_handler(uint8_t *packet, int size){
// sanity check
if (conn->acl_recombination_pos == 0) {
log_err( "ACL Cont Fragment but no first fragment for handle 0x%02x\n", con_handle);
log_error( "ACL Cont Fragment but no first fragment for handle 0x%02x\n", con_handle);
return;
}
@ -280,7 +280,7 @@ static void acl_handler(uint8_t *packet, int size){
memcpy(&conn->acl_recombination_buffer[conn->acl_recombination_pos], &packet[4], acl_length );
conn->acl_recombination_pos += acl_length;
// log_err( "ACL Cont Fragment: acl_len %u, combined_len %u, l2cap_len %u\n", acl_length,
// log_error( "ACL Cont Fragment: acl_len %u, combined_len %u, l2cap_len %u\n", acl_length,
// conn->acl_recombination_pos, conn->acl_recombination_length);
// forward complete L2CAP packet if complete.
@ -297,14 +297,14 @@ static void acl_handler(uint8_t *packet, int size){
// sanity check
if (conn->acl_recombination_pos) {
log_err( "ACL First Fragment but data in buffer for handle 0x%02x\n", con_handle);
log_error( "ACL First Fragment but data in buffer for handle 0x%02x\n", con_handle);
return;
}
// peek into L2CAP packet!
uint16_t l2cap_length = READ_L2CAP_LENGTH( packet );
// log_err( "ACL First Fragment: acl_len %u, l2cap_len %u\n", acl_length, l2cap_length);
// log_error( "ACL First Fragment: acl_len %u, l2cap_len %u\n", acl_length, l2cap_length);
// compare fragment size to L2CAP packet size
if (acl_length >= l2cap_length + 4){
@ -323,7 +323,7 @@ static void acl_handler(uint8_t *packet, int size){
}
default:
log_err( "hci.c: acl_handler called with invalid packet boundary flags %u\n", acl_flags & 0x03);
log_error( "hci.c: acl_handler called with invalid packet boundary flags %u\n", acl_flags & 0x03);
return;
}
@ -394,7 +394,7 @@ static void event_handler(uint8_t *packet, int size){
uint16_t num_packets = READ_BT_16(packet, 3 + packet[2]*2 + 2*i);
conn = connection_for_handle(handle);
if (!conn){
log_err("hci_number_completed_packet lists unused con handle %u\n", handle);
log_error("hci_number_completed_packet lists unused con handle %u\n", handle);
continue;
}
conn->num_acl_packets_sent -= num_packets;
@ -625,7 +625,7 @@ static int hci_power_control_on(void){
err = (*hci_stack.control->on)(hci_stack.config);
}
if (err){
log_err( "POWER_ON failed\n");
log_error( "POWER_ON failed\n");
hci_emit_hci_open_failed();
return err;
}
@ -633,7 +633,7 @@ static int hci_power_control_on(void){
// open low-level device
err = hci_stack.hci_transport->open(hci_stack.config);
if (err){
log_err( "HCI_INIT failed, turning Bluetooth off again\n");
log_error( "HCI_INIT failed, turning Bluetooth off again\n");
if (hci_stack.control && hci_stack.control->off){
(*hci_stack.control->off)(hci_stack.config);
}
@ -694,7 +694,7 @@ static int hci_power_control_wake(void){
// open low-level device
int err = hci_stack.hci_transport->open(hci_stack.config);
if (err){
log_err( "HCI_INIT failed, turning Bluetooth off again\n");
log_error( "HCI_INIT failed, turning Bluetooth off again\n");
if (hci_stack.control && hci_stack.control->off){
(*hci_stack.control->off)(hci_stack.config);
}

View File

@ -252,7 +252,7 @@ static void h4_statemachine(void){
bytes_to_read = HCI_ACL_DATA_PKT_HDR;
h4_state = H4_W4_ACL_HEADER;
} else {
log_err("h4_process: invalid packet type 0x%02x\n", hci_packet[0]);
log_error("h4_process: invalid packet type 0x%02x\n", hci_packet[0]);
read_pos = 0;
bytes_to_read = 1;
}

View File

@ -150,7 +150,7 @@ static void h4_block_received(void){
bytes_to_read = HCI_EVENT_PKT_HDR;
break;
default:
log_err("h4_process: invalid packet type 0x%02x\r\n", hci_packet[0]);
log_error("h4_process: invalid packet type 0x%02x\r\n", hci_packet[0]);
read_pos = 0;
h4_state = H4_W4_PACKET_TYPE;
bytes_to_read = 1;
@ -252,7 +252,7 @@ static int h4_send_packet(uint8_t packet_type, uint8_t *packet, int size){
// write in progress
if (tx_state != TX_IDLE) {
log_err("h4_send_packet with tx_state = %u, type %u, data %02x %02x %02x", tx_state, packet_type, packet[0], packet[1], packet[2]);
log_error("h4_send_packet with tx_state = %u, type %u, data %02x %02x %02x", tx_state, packet_type, packet[0], packet[1], packet[2]);
return -1;
}

View File

@ -143,7 +143,7 @@ static libusb_device * scan_for_bt_device(libusb_device **devs) {
while ((dev = devs[i++]) != NULL) {
int r = libusb_get_device_descriptor(dev, &desc);
if (r < 0) {
log_err(stderr, "failed to get device descriptor");
log_error(stderr, "failed to get device descriptor");
return 0;
}
@ -191,7 +191,7 @@ static void async_callback(struct libusb_transfer *transfer)
r = libusb_submit_transfer(transfer);
if (r) {
log_err(stderr, "Error re-submitting transfer %d\n", r);
log_error(stderr, "Error re-submitting transfer %d\n", r);
}
}
}
@ -234,7 +234,7 @@ static int usb_process_ds(struct data_source *ds) {
r = libusb_submit_transfer(handle_packet);
if (r) {
log_err(stderr, "Error re-submitting transfer %d\n", r);
log_error(stderr, "Error re-submitting transfer %d\n", r);
}
}
@ -344,7 +344,7 @@ static int usb_open(void *transport_config){
#ifndef __APPLE__
r = libusb_kernel_driver_active(handle, 0);
if (r < 0) {
log_err(stderr, "libusb_kernel_driver_active error %d\n", r);
log_error(stderr, "libusb_kernel_driver_active error %d\n", r);
usb_close();
return r;
}
@ -352,7 +352,7 @@ static int usb_open(void *transport_config){
if (r == 1) {
r = libusb_detach_kernel_driver(handle, 0);
if (r < 0) {
log_err(stderr, "libusb_detach_kernel_driver error %d\n", r);
log_error(stderr, "libusb_detach_kernel_driver error %d\n", r);
usb_close();
return r;
}
@ -365,7 +365,7 @@ static int usb_open(void *transport_config){
log_info("claiming interface 0...\n");
r = libusb_claim_interface(handle, 0);
if (r < 0) {
log_err(stderr, "Error claiming interface %d\n", r);
log_error(stderr, "Error claiming interface %d\n", r);
usb_close();
return r;
}
@ -397,7 +397,7 @@ static int usb_open(void *transport_config){
r = libusb_submit_transfer(event_in_transfer[c]);
if (r) {
log_err(stderr, "Error submitting interrupt transfer %d\n", r);
log_error(stderr, "Error submitting interrupt transfer %d\n", r);
usb_close();
return r;
}
@ -408,7 +408,7 @@ static int usb_open(void *transport_config){
r = libusb_submit_transfer(bulk_in_transfer[c]);
if (r) {
log_err(stderr, "Error submitting bulk in transfer %d\n", r);
log_error(stderr, "Error submitting bulk in transfer %d\n", r);
usb_close();
return r;
}
@ -497,7 +497,7 @@ static int usb_send_cmd_packet(uint8_t *packet, int size){
0, 0, 0, packet, size, 2000);
if (r < 0 || r !=size ) {
log_err(stderr, "Error submitting control transfer %d\n", r);
log_error(stderr, "Error submitting control transfer %d\n", r);
return r;
}
@ -514,7 +514,7 @@ static int usb_send_acl_packet(uint8_t *packet, int size){
// Use synchronous call to sent out data
r = libusb_bulk_transfer(handle, acl_out_addr, packet, size, &t, 1000);
if(r < 0){
log_err(stderr, "Error submitting data transfer");
log_error(stderr, "Error submitting data transfer");
}
return 0;

View File

@ -331,7 +331,7 @@ int l2cap_send_internal(uint16_t local_cid, uint8_t *data, uint16_t len){
// log_info("l2cap_send_internal cid %u, handle %u, 1 credit used, credits left %u;\n",
// local_cid, channel->handle, channel->packets_granted);
} else {
log_err("l2cap_send_internal cid %u, no credits!\n", local_cid);
log_error("l2cap_send_internal cid %u, no credits!\n", local_cid);
}
// 0 - Connection handle : PB=10 : BC=00
@ -669,7 +669,7 @@ static void l2cap_handle_connection_request(hci_con_handle_t handle, uint8_t sig
hci_connection_t * hci_connection = connection_for_handle( handle );
if (!hci_connection) {
log_err("no hci_connection for handle %u\n", handle);
log_error("no hci_connection for handle %u\n", handle);
// TODO: emit error
return;
}
@ -711,7 +711,7 @@ static void l2cap_handle_connection_request(hci_con_handle_t handle, uint8_t sig
void l2cap_accept_connection_internal(uint16_t local_cid){
l2cap_channel_t * channel = l2cap_get_channel_for_local_cid(local_cid);
if (!channel) {
log_err("l2cap_accept_connection_internal called but local_cid 0x%x not found", local_cid);
log_error("l2cap_accept_connection_internal called but local_cid 0x%x not found", local_cid);
return;
}
@ -724,7 +724,7 @@ void l2cap_accept_connection_internal(uint16_t local_cid){
void l2cap_decline_connection_internal(uint16_t local_cid, uint8_t reason){
l2cap_channel_t * channel = l2cap_get_channel_for_local_cid( local_cid);
if (!channel) {
log_err( "l2cap_decline_connection_internal called but local_cid 0x%x not found", local_cid);
log_error( "l2cap_decline_connection_internal called but local_cid 0x%x not found", local_cid);
return;
}
channel->state = L2CAP_STATE_WILL_SEND_CONNECTION_RESPONSE_DECLINE;

View File

@ -1303,13 +1303,13 @@ void rfcomm_channel_packet_handler(rfcomm_multiplexer_t * multiplexer, uint8_t
break;
default:
log_err("Received unknown UIH packet - 0x%02x\n", packet[payload_offset]);
log_error("Received unknown UIH packet - 0x%02x\n", packet[payload_offset]);
break;
}
break;
default:
log_err("Received unknown RFCOMM message type %x\n", packet[1]);
log_error("Received unknown RFCOMM message type %x\n", packet[1]);
break;
}
@ -1723,7 +1723,7 @@ int rfcomm_send_internal(uint8_t rfcomm_cid, uint8_t *data, uint16_t len){
rfcomm_channel_t * channel = rfcomm_channel_for_rfcomm_cid(rfcomm_cid);
if (!channel){
log_err("rfcomm_send_internal cid %u doesn't exist!\n", rfcomm_cid);
log_error("rfcomm_send_internal cid %u doesn't exist!\n", rfcomm_cid);
return 0;
}

View File

@ -61,7 +61,7 @@ extern run_loop_t run_loop_cocoa;
void run_loop_assert(void){
#ifndef EMBEDDED
if (!the_run_loop){
log_err("ERROR: run_loop function called before run_loop_init!\n");
log_error("ERROR: run_loop function called before run_loop_init!\n");
exit(10);
}
#endif
@ -116,7 +116,7 @@ void run_loop_execute() {
void run_loop_init(RUN_LOOP_TYPE type){
#ifndef EMBEDDED
if (the_run_loop){
log_err("ERROR: run loop initialized twice!\n");
log_error("ERROR: run loop initialized twice!\n");
exit(10);
}
#endif
@ -136,7 +136,7 @@ void run_loop_init(RUN_LOOP_TYPE type){
#endif
default:
#ifndef EMBEDDED
log_err("ERROR: invalid run loop type %u selected!\n", type);
log_error("ERROR: invalid run loop type %u selected!\n", type);
exit(10);
#endif
break;

View File

@ -141,7 +141,7 @@ void cocoa_execute(void)
}
void cocoa_dump_timer(void){
log_err("WARNING: run_loop_dump_timer not implemented!");
log_error("WARNING: run_loop_dump_timer not implemented!");
return;
}

View File

@ -77,7 +77,7 @@ void posix_add_timer(timer_source_t *ts){
linked_item_t *it;
for (it = (linked_item_t *) &timers; it->next ; it = it->next){
if ((timer_source_t *) it->next == ts){
log_err( "run_loop_timer_add error: timer to add already in list!\n");
log_error( "run_loop_timer_add error: timer to add already in list!\n");
return;
}
if (run_loop_timer_compare( (timer_source_t *) it->next, ts) > 0) {

View File

@ -137,7 +137,7 @@ uint32_t sdp_register_service_internal(void *connection, service_record_item_t *
// check for ServiceRecordHandle attribute, returns pointer or null
uint8_t * req_record_handle = sdp_get_attribute_value_for_attribute_id(record, SDP_ServiceRecordHandle);
if (!req_record_handle) {
log_err("SDP Error - record does not contain ServiceRecordHandle attribute\n");
log_error("SDP Error - record does not contain ServiceRecordHandle attribute\n");
return 0;
}

View File

@ -309,7 +309,7 @@ int socket_connection_create_tcp(int port){
// create tcp socket
if ((ds->fd = socket (PF_INET, SOCK_STREAM, 0)) < 0) {
log_err("Error creating socket ...(%s)\n", strerror(errno));
log_error("Error creating socket ...(%s)\n", strerror(errno));
free(ds);
return -1;
}
@ -325,13 +325,13 @@ int socket_connection_create_tcp(int port){
setsockopt(ds->fd, SOL_SOCKET, SO_REUSEADDR, &y, sizeof(int));
if (bind ( ds->fd, (struct sockaddr *) &addr, sizeof (addr) ) ) {
log_err("Error on bind() ...(%s)\n", strerror(errno));
log_error("Error on bind() ...(%s)\n", strerror(errno));
free(ds);
return -1;
}
if (listen (ds->fd, MAX_PENDING_CONNECTIONS)) {
log_err("Error on listen() ...(%s)\n", strerror(errno));
log_error("Error on listen() ...(%s)\n", strerror(errno));
free(ds);
return -1;
}
@ -379,24 +379,24 @@ int socket_connection_create_launchd(){
*
*/
if ((checkin_request = launch_data_new_string(LAUNCH_KEY_CHECKIN)) == NULL) {
log_err( "launch_data_new_string(\"" LAUNCH_KEY_CHECKIN "\") Unable to create string.");
log_error( "launch_data_new_string(\"" LAUNCH_KEY_CHECKIN "\") Unable to create string.");
return -1;
}
if ((checkin_response = launch_msg(checkin_request)) == NULL) {
log_err( "launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %u", errno);
log_error( "launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %u", errno);
return -1;
}
if (LAUNCH_DATA_ERRNO == launch_data_get_type(checkin_response)) {
errno = launch_data_get_errno(checkin_response);
log_err( "Check-in failed: %u", errno);
log_error( "Check-in failed: %u", errno);
return -1;
}
launch_data_t the_label = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_LABEL);
if (NULL == the_label) {
log_err( "No label found");
log_error( "No label found");
return -1;
}
@ -405,12 +405,12 @@ int socket_connection_create_launchd(){
*/
sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS);
if (NULL == sockets_dict) {
log_err("No sockets found to answer requests on!");
log_error("No sockets found to answer requests on!");
return -1;
}
// if (launch_data_dict_get_count(sockets_dict) > 1) {
// log_err("Some sockets will be ignored!");
// log_error("Some sockets will be ignored!");
// }
/*
@ -418,7 +418,7 @@ int socket_connection_create_launchd(){
*/
listening_fd_array = launch_data_dict_lookup(sockets_dict, "Listeners");
if (listening_fd_array) {
// log_err("Listeners...\n");
// log_error("Listeners...\n");
socket_connection_launchd_register_fd_array( listening_fd_array );
}
@ -427,7 +427,7 @@ int socket_connection_create_launchd(){
*/
listening_fd_array = launch_data_dict_lookup(sockets_dict, "Listeners2");
if (listening_fd_array) {
// log_err("Listeners2...\n");
// log_error("Listeners2...\n");
socket_connection_launchd_register_fd_array( listening_fd_array );
}
@ -450,7 +450,7 @@ int socket_connection_create_unix(char *path){
// create unix socket
if ((ds->fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) {
log_err( "Error creating socket ...(%s)\n", strerror(errno));
log_error( "Error creating socket ...(%s)\n", strerror(errno));
free(ds);
return -1;
}
@ -467,13 +467,13 @@ int socket_connection_create_unix(char *path){
setsockopt(ds->fd, SOL_SOCKET, SO_REUSEADDR, &y, sizeof(int));
if (bind ( ds->fd, (struct sockaddr *) &addr, sizeof (addr) ) ) {
log_err( "Error on bind() ...(%s)\n", strerror(errno));
log_error( "Error on bind() ...(%s)\n", strerror(errno));
free(ds);
return -1;
}
if (listen (ds->fd, MAX_PENDING_CONNECTIONS)) {
log_err( "Error on listen() ...(%s)\n", strerror(errno));
log_error( "Error on listen() ...(%s)\n", strerror(errno));
free(ds);
return -1;
}