use stderr for errors, stdout for log

This commit is contained in:
matthias.ringwald 2009-09-22 20:03:48 +00:00
parent e5acacfeb2
commit 942671929b
6 changed files with 33 additions and 34 deletions

View File

@ -1,34 +1,39 @@
/* new todo file for BTstack */
Last milestone reached: BTdaemon automatically started by launchd on Mac and iPhone
Last milestone reached: BTdaemon uses SpringBoardAccess to show status bar icons
NEXT:
- check why test.c does not start up instantly when Bluetooth is already turned on
- clean up debug output: messages to stdout, errors to stderr
- decide on error reporting from BTdaemon
- command_status_event with custom errors
- hci open failed
- btstack error
- create script to build APT package
- add svn revision to package.sh tool for SpringBoardAccess
- create dylib of client library
- create script to build APT package for BTdeamon, Resources, and BTstack client library
- create new pgp key for gmail account and sign APT package
- provide test version by setting up APT repository within BTstack SVN
- instructions: http://www.saurik.com/id/7
== Release Version 0.1
- implement rest of L2CAP state machine
- incoming connections
- list of supported PSM
- commands and events
- detect and handle iPhone sleep mode
- see iPhone imnsomnia project at http://code.google.com/p/iphone-insomnia/
- can we get willGoToSleep event, should we should down?
- would be nice, if we could get woken up by Bluetooth data
- CocoaTouch User Interface Components
- Inquiry
- Alerts and shutdown of Apple's stack
== Release 0.2 - Incoming L2CAP supported + UI Support
- better deal with Apple stack
- figure out how to shut it down
- user interface
- extend SpringBoard feedback
- show alerts/messages using SpringBoardAcccess, e.g. Bluetooth disconnected by remote device
- add code to notify about remote disconnets
- Detect and handle iPhone sleep mode
- see iPhone imnsomnia project at http://code.google.com/p/iphone-insomnia/
- CocoaTouch User Interface Components
- Inquiry
- Alerts and shutdown of Apple's stack
== Release 0.2 - Incoming L2CAP supported + UI Support
- configuration: /etc/btstack
- single Bluetooth module supported
- transport type: H4, H5, USB

View File

@ -14,12 +14,9 @@
9C00F86510191097008DAB17 /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C00F86210191097008DAB17 /* utils.c */; };
9C00F87410191130008DAB17 /* l2cap_signaling.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C00F87210191130008DAB17 /* l2cap_signaling.c */; };
9C05FC971020D3F300255261 /* socket_connection.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C00F7301017ACC3008DAB17 /* socket_connection.c */; };
9C1813F81042FCCA00C68F09 /* mitm.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C1813F71042FCCA00C68F09 /* mitm.c */; };
9C1F0E9A0FDAE023008F472F /* run_loop.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C1F0E980FDAE023008F472F /* run_loop.c */; };
9C2071F310014D3200A07EA4 /* hci_transport_usb.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C2071F210014D3200A07EA4 /* hci_transport_usb.c */; };
9C46FC3A0FA906F700ABEF05 /* hci_transport_h4.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C46FC360FA906F700ABEF05 /* hci_transport_h4.c */; };
9C77E7511066680800F39DCF /* SpringBoardAccessExtension.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9C77E7501066680800F39DCF /* SpringBoardAccessExtension.mm */; };
9C77E75510666B5D00F39DCF /* SpringBoardAccess.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C77E75310666B5D00F39DCF /* SpringBoardAccess.c */; };
9C77E79210667F0600F39DCF /* platform_iphone.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C77E79110667F0600F39DCF /* platform_iphone.c */; };
9C7B5AC0100BD3340065D87E /* linked_list.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C7B5ABF100BD3340065D87E /* linked_list.c */; };
9C7B5D01100FC9AE0065D87E /* btstack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9CC813A10FFC0774002816F9 /* btstack.c */; };
@ -76,6 +73,7 @@
9C77E75310666B5D00F39DCF /* SpringBoardAccess.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = SpringBoardAccess.c; path = SpringBoardAccess/SpringBoardAccess.c; sourceTree = "<group>"; };
9C77E75410666B5D00F39DCF /* SpringBoardAccess.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = SpringBoardAccess.h; path = SpringBoardAccess/SpringBoardAccess.h; sourceTree = "<group>"; };
9C77E79110667F0600F39DCF /* platform_iphone.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = platform_iphone.c; path = src/platform_iphone.c; sourceTree = "<group>"; };
9C77E7BC1066AC4100F39DCF /* control */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; name = control; path = SpringBoardAccess/control; sourceTree = "<group>"; };
9C78A04A103C6734003B2950 /* Default_BTstack.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default_BTstack.png; path = resources/Default_BTstack.png; sourceTree = "<group>"; };
9C78A04B103C6734003B2950 /* Default_BTstackActive.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default_BTstackActive.png; path = resources/Default_BTstackActive.png; sourceTree = "<group>"; };
9C78A04C103C6734003B2950 /* FSO_BTstack.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FSO_BTstack.png; path = resources/FSO_BTstack.png; sourceTree = "<group>"; };
@ -185,6 +183,7 @@
9C77E2751060322300F39DCF /* SpringBoardAccess */ = {
isa = PBXGroup;
children = (
9C77E7BC1066AC4100F39DCF /* control */,
9C77E75310666B5D00F39DCF /* SpringBoardAccess.c */,
9C77E75410666B5D00F39DCF /* SpringBoardAccess.h */,
9C77E7501066680800F39DCF /* SpringBoardAccessExtension.mm */,
@ -307,9 +306,6 @@
9C00F86510191097008DAB17 /* utils.c in Sources */,
9C00F87410191130008DAB17 /* l2cap_signaling.c in Sources */,
9CCE6CEA1025BD0000FCE9F4 /* hci.c in Sources */,
9C1813F81042FCCA00C68F09 /* mitm.c in Sources */,
9C77E7511066680800F39DCF /* SpringBoardAccessExtension.mm in Sources */,
9C77E75510666B5D00F39DCF /* SpringBoardAccess.c in Sources */,
9C77E79210667F0600F39DCF /* platform_iphone.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -99,7 +99,6 @@ static int iphone_write_initscript (hci_uart_config_t *uart_config, int output){
// calculate baud rate (assume rate is multiply of 100)
uint32_t baud_key = (4096 * (uart_config->baudrate/100) + 4999) / 10000;
// printf("Baud key %u\n", baud_key);
// construct script path from device name
strcpy(buffer, "/etc/bluetool/");

View File

@ -96,7 +96,7 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
break;
default:
//@TODO: log into hci dump as vendor specific "event"
printf("Error: command %u not implemented\n:", READ_CMD_OCF(packet));
fprintf(stderr, "Error: command %u not implemented\n:", READ_CMD_OCF(packet));
break;
}
return 0;
@ -126,7 +126,7 @@ static int daemon_client_handler(connection_t *connection, uint16_t packet_type,
l2cap_close_channels_for_connection(connection);
break;
case DAEMON_NR_CONNECTIONS_CHANGED:
// printf("Nr Connections changed, new %u\n", data[1]);
printf("Nr Connections changed, new %u\n", data[1]);
if (data[1]) {
run_loop_remove_timer(&timeout);
} else {

View File

@ -189,7 +189,6 @@ static int h4_process(struct data_source *ds) {
if (bytes_read < 0) {
return bytes_read;
}
// printf("Bytes read: %u\n", bytes_read);
bytes_to_read -= bytes_read;
read_pos += bytes_read;
if (bytes_to_read > 0) {

View File

@ -203,12 +203,12 @@ int socket_connection_create_tcp(int port){
// create tcp socket
if ((ds->fd = socket (PF_INET, SOCK_STREAM, 0)) < 0) {
printf ("Error creating socket ...(%s)\n", strerror(errno));
fprintf (stderr, "Error creating socket ...(%s)\n", strerror(errno));
free(ds);
return -1;
}
printf ("Socket created\n");
printf ("Socket created for port %u\n", port);
struct sockaddr_in addr;
addr.sin_family = AF_INET;
@ -219,13 +219,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) ) ) {
printf ("Error on bind() ...(%s)\n", strerror(errno));
fprintf(stderr, "Error on bind() ...(%s)\n", strerror(errno));
free(ds);
return -1;
}
if (listen (ds->fd, MAX_PENDING_CONNECTIONS)) {
printf ("Error on listen() ...(%s)\n", strerror(errno));
fprintf (stderr, "Error on listen() ...(%s)\n", strerror(errno));
free(ds);
return -1;
}
@ -253,24 +253,24 @@ int socket_connection_create_unix(char *path){
*
*/
if ((checkin_request = launch_data_new_string(LAUNCH_KEY_CHECKIN)) == NULL) {
printf("launch_data_new_string(\"" LAUNCH_KEY_CHECKIN "\") Unable to create string.");
fprintf(stderr, "launch_data_new_string(\"" LAUNCH_KEY_CHECKIN "\") Unable to create string.");
return -1;
}
if ((checkin_response = launch_msg(checkin_request)) == NULL) {
printf("launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %u", errno);
fprintf(stderr, "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);
printf("Check-in failed: %u", errno);
fprintf(stderr, "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) {
printf("No label found");
fprintf(stderr, "No label found");
return -1;
}
@ -279,12 +279,12 @@ int socket_connection_create_unix(char *path){
*/
sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS);
if (NULL == sockets_dict) {
printf("No sockets found to answer requests on!");
fprintf(stderr,"No sockets found to answer requests on!");
return -1;
}
if (launch_data_dict_get_count(sockets_dict) > 1) {
printf("Some sockets will be ignored!");
fprintf(stderr,"Some sockets will be ignored!");
}
/*
@ -292,7 +292,7 @@ int socket_connection_create_unix(char *path){
*/
listening_fd_array = launch_data_dict_lookup(sockets_dict, "Listeners");
if (NULL == listening_fd_array) {
printf("No known sockets found to answer requests on!");
fprintf(stderr,"No known sockets found to answer requests on!");
return -1;
}
@ -326,7 +326,7 @@ int socket_connection_create_unix(char *path){
// create unix socket
if ((ds->fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) {
printf ("Error creating socket ...(%s)\n", strerror(errno));
fprintf(stderr, "Error creating socket ...(%s)\n", strerror(errno));
free(ds);
return -1;
}
@ -343,13 +343,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) ) ) {
printf ("Error on bind() ...(%s)\n", strerror(errno));
fprintf(stderr, "Error on bind() ...(%s)\n", strerror(errno));
free(ds);
return -1;
}
if (listen (ds->fd, MAX_PENDING_CONNECTIONS)) {
printf ("Error on listen() ...(%s)\n", strerror(errno));
fprintf(stderr, "Error on listen() ...(%s)\n", strerror(errno));
free(ds);
return -1;
}