[gnome-bluetooth] PalmOS support hack for libbtctrl - patch

Nicholas Piper nick-gnomebluetooth at nickpiper.co.uk
Thu Aug 28 13:09:55 BST 2003


Hi,

Here is a patch to allow discovery of the OPUSH port on a Palm OS
device.

PalmOS doesn't respond to SDP browse requests :-( It will answer if
you ask about a specific facility though.

So my patch browses each device twice, once specifying OPUSH. That
way, the OPUSH ends up in gconf, and now I can send files to it with
obex and the nice drag-and-drop.

Can anyone think of a better way ?

Maybe if the device gave an OPUSH port already, not to ask it again?

 Nick

-- 
Part 4 MEng Cybernetics; Reading, UK       http://www.nickpiper.co.uk/
GPG Encrypted mail welcome!                             1024D/3ED8B27F
Choose life. Be Vegan :-) Please reduce needless cruelty + suffering !
-------------- next part --------------
*** libbtctl-0.3-orig/libbtctl-0.3/src/btctlimpl.c	Fri Feb 21 15:26:14 2003
--- libbtctl-0.3/src/btctlimpl.c	Thu Aug 28 11:50:30 2003
***************
*** 394,403 ****
  			/* Display user friendly form */
  			/* btlctl_impl_report_service_attr(rec);*/
  
! 		  print_service_attr(bc, str, rec);
  		}
  		printf("\n");
! 		
  		if (sdp_get_group_id(rec, &sub_context.group) != -1) {
  			/* Set the subcontext for browsing the sub tree */
  			memcpy(&sub_context, context, sizeof(struct search_context));
--- 394,405 ----
  			/* Display user friendly form */
  			/* btlctl_impl_report_service_attr(rec);*/
  
! 		        /* printf("printing & registering record...\n"); */
! 		        print_service_attr(bc, str, rec);
  		}
+ 
  		printf("\n");
! 
  		if (sdp_get_group_id(rec, &sub_context.group) != -1) {
  			/* Set the subcontext for browsing the sub tree */
  			memcpy(&sub_context, context, sizeof(struct search_context));
***************
*** 418,428 ****
  {
    struct search_context context;
  
    memset(&context, '\0', sizeof(struct search_context));
-   /* We want to browse the top-level/root */
    sdp_uuid16_create(&(context.group), PUBLIC_BROWSE_GROUP);
-   if (bdaddr) 
- 	return do_search(bc, bdaddr, &context);
    return do_search(bc, 0, &context);
  }
  
--- 420,452 ----
  {
    struct search_context context;
  
+ 
+   if (bdaddr) {
+ 
+     /* Not sure if this is the best way to combine two do_searches in
+        terms of their return values. The returned value from
+        do_browse() doesn't seem to be used yet, anyway. */
+ 
+     /* Specify OPUSH for now, so that we actually find PalmOS (5?) devices */
+     /* The Palm has to be powered ON as well, this won't wake it up. */
+     memset(&context, '\0', sizeof(struct search_context));
+     context.svc = "OPUSH";
+     sdp_uuid16_create(&context.group, OBEX_OBJPUSH_SVCLASS_ID);
+     if (do_search(bc, bdaddr, &context) == -1) {
+       return -1;
+     }
+ 
+     /* We want to browse the top-level/root */
+     memset(&context, '\0', sizeof(struct search_context));
+     sdp_uuid16_create(&(context.group), PUBLIC_BROWSE_GROUP);
+     if (do_search(bc, bdaddr, &context) == -1) {
+       return -1;
+     }
+     return 0;
+   };
+ 
    memset(&context, '\0', sizeof(struct search_context));
    sdp_uuid16_create(&(context.group), PUBLIC_BROWSE_GROUP);
    return do_search(bc, 0, &context);
  }
  


More information about the gnome-bluetooth mailing list