[maemo-developers] n810, getting at the bluetooth from obexftp and obexfs?

From: Ben Martin monkeyiq at users.sourceforge.net
Date: Sun Jan 11 13:44:36 EET 2009
Hi,
  After some digging and RTFMing, the bluetooth support in dialogs and
apps for browsing remote filesystems (OBEX) is done through a gnome-vfs
module, which uses libgwobex, which uses libopenobex. pp.389 of [1] has
more information on libgwobex which is a higher level abstraction ontop
of libopenobex.

  My plan, and reason to dig into this, is to use the obexfs FUSE
filesystem to mount (probably part of) my phone's microsd card to ~/fuse
so that applications like kagu can play audio files streamed over obex.
ie, be able to easily capitalize on a 16gb card in my phone from the
n810.

I've got obexftp installed, but attempts to run it either fail right
away (if the gnome-vfs module is in use and the bluetooth status icon is
blue) or after a short period otherwise. The same commands work fine for
putting a file to an e71 phone when executed on a desktop machine. I'm
trying obexftp first, though I also have obexfs ready to go once I solve
the connectivity issue :/

desktop$ date >| df.txt
desktop$ obexftp -b $FOO_BTADDR -B 11 --put df.txt
Connecting...done
Sending "df.txt"... done
Disconnecting...done

n810$ date >| df.txt
n810$ obexftp -b $FOO_BTADDR -B 11 --verbose --put df.txt 
Browsing xx:xx:xx... ...
Channel: 11
Connecting...failed: connect
Still trying to connect
Connecting...failed: connect
Still trying to connect
Connecting...failed: connect
Still trying to connect

When the gnome-vfs module is not in use and I try the above obexftp
command, the phone shows the connection brackets around the bluetooth
icon, so it appears that the n810 is making a connection OK, for a very
short period. The phone is already paired with the n810 and has the n810
set as a trusted device etc prior to using obexftp. The file manager can
happily connect and browse the phone without any intervention on the
e71.

Has anyone used the raw libopenobex library to connect to other devices?
Or is there something in the gwobex library that you have to also call
to make sure the n810 actually lets the BT radio be used?

I'll have a closer dig into gwobex to try to find this out myself too.

ldd /usr/bin/obexftp
	libopenobex.so.1 => /usr/lib/libopenobex.so.1 (0x43b08000)
	libbluetooth.so.2 => /usr/lib/libbluetooth.so.2 (0x42120000)
	libc.so.6 => /lib/libc.so.6 (0x41028000)
	/lib/ld-linux.so.3 (0x41000000)

strace output:
execve("/usr/bin/obexftp", ["obexftp", "-b", "XX:XX:XX", "-B", "11", "--verbose", "--put", "/tmp/df.txt"], [/* 63 vars */]) = 0
...
socket(PF_BLUETOOTH, SOCK_RAW, 1)       = 3                                                               
ioctl(3, ...)        = 0                                                               
close(3)                                = 0                                                               
brk(0)                                  = 0x19000                                                         
brk(0x3a000)                            = 0x3a000                                                         
socket(PF_BLUETOOTH, SOCK_SEQPACKET, 0) = 3                                                               
bind(3, {sa_family=AF_BLUETOOTH, sa_data="..."...}, 10) = 0                   
connect(3, {sa_family=AF_BLUETOOTH, sa_data="..."...}, 10) = 0              
write(2, "Browsing XX:XX:XX ...\n"..., 31Browsing XX:XX:XX ...                          
) = 31                                                                                                    
send(3, "..."..., 18, 0) = 18                                        
select(4, [3], NULL, NULL, {20, 0})     = 1 (in [3], left {19, 976562})                                   
recv(3, "..."..., 65535, 0) = 34
write(2, "Channel: 11\n"..., 12Channel: 11                                                                
)        = 12                                                                                         
close(3)                                = 0                                                  
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0                                                     
write(2, "Connecting..."..., 13Connecting...)        = 13                                                 
write(2, "failed: connect\n"..., 16failed: connect                                                        
)    = 16                                                                                                 
write(2, "Still trying to connect\n"..., 24Still trying to connect                                        
) = 24                                                                                                    
write(2, "Connecting..."..., 13Connecting...)        = 13                                                 
write(2, "failed: connect\n"..., 16failed: connect                                                        
)    = 16                                                                                                 
write(2, "Still trying to connect\n"..., 24Still trying to connect                                        



[1]
http://maemo.org/maemo_release_documentation/maemo4.1.x/Maemo_Diablo_Reference_Manual_for_maemo_4.1.pdf

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.maemo.org/pipermail/maemo-developers/attachments/20090111/1de478ac/attachment.pgp 
More information about the maemo-developers mailing list