LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Obex push over bluetooth from cli in Slackware? (https://www.linuxquestions.org/questions/slackware-14/obex-push-over-bluetooth-from-cli-in-slackware-4175467388/)

xj25vm 06-25-2013 05:43 PM

Obex push over bluetooth from cli in Slackware?
 
I need to obex push a file to a mobile phone from cli in Slackware. I'm trying to figure out:

1. What tools do I need.
2. If Slackware has them by default.

I assume I will have to scan for the phone and pair with it first using bluez and associated tools - I'm OK with that as I've stumbled (painfully) through it several times in the past for other projects - including connecting to a Bluetooth printer. My questions are:

a. I see Slackware includes "obexput" and "obexftp" commands. Are any of the two commands what I need to send a file to the phone - or is obexftp a different (but related) protocol.

b. Google searches mention a command called obex_push - is this something that is out of date or specific to other distro's - or should I try to get it installed on Slackware from somewhere.

Any advice form those who have dealt with this before is appreciated. I assume blueman would be able to do this - but I've managed to get my bluetooth stuff (eventually) sorted exclusively on the cli in the past - so I'd like to keep it that way - if possible.

Didier Spaier 06-25-2013 05:50 PM

All obex commands available in Slackware have their own man page, to know more just type:
man obexftpd
man obexput
man obex-data-server
man obexls
man obexftp
man obexget
man obexrm

I think all you need is there.

xj25vm 06-25-2013 07:12 PM

Thanks Didier. From what I can see, it seems that obexput, obexls, obexget and obexrm are wrappers around obexftp.

I've managed to pair up with the mobile. I've managed to send my .prov file to the phone with obexftp - I can upload it in the phone memory or on the microsd card. However, the phone is supposed to recognise this file automatically and import it as a SIP configuration file - according to my reading. I'm trying to push the the phone a .prov file containing SIP settings for the SIP client software on the phone (it is a Nokia).

As it stands, the file is on the phone, but the phone settings haven't been affected by it. If my understanding is correct, OBEX push is different from OBEX ftp - in that the phone is suppose to somehow recognise and act on the pushed file/object automatically. I think it can also be used to push business cards and other items between phones as well. However, I can't find a clear definition of all this.

xj25vm 06-25-2013 08:25 PM

Right! It seems this one has been cracked. For the benefit of others who might need this info, the short conclusions are:

1. OBEX push and OBEX file transfer are two different services.
2. obexftp can do both of them - with the correct command switches.

The steps:

a. Pair your phone with the computer. I won't go into great detail here - in short I just did on the laptop (after putting the phone in discoverable mode):

Code:

      hciconfig hci0 up
      hcitool scan
      simple-agent hci0 XX:XX:XX:XX:XX:XX
      test-device trusted XX:XX:XX:XX:XX:XX yes

The "XX.XX...." bit is your phone's bluetooth HW address - obtained with "hcitool scan". Input same PIN code on phone and computer (make one up) when prompted. "simple-agent" and "test-device" are python scripts which come with bluez sources, in the "test" folder. I downloaded bluez sources from ... erm, bluez website. The last command stops the computer from asking for the PIN every time the mobile connects to it.

b. Find out on what channel the OBEX PUSH service is offered on your device/mobile:

Code:

    sdptool search --bdaddr XX:XX:XX:XX:XX:XX OPUSH
Look in the output for a "Channel n"

c. Using the channel discovered with the command above, push the OBEX object to the phone:

Code:

obexftp  --nopath --noconn --uuid none --bluetooth -b  XX:XX:XX:XX:XX:XX -B 9 -put myfile.prov
In my case, channel 9 was the OBEX push channel - but amend as necessary. The first three options and the correct channel number are necessary for OBEX PUSH (as opposed to OBEX file transfer) in order for the phone to interpret the received file automatically and correctly and act on it. Otherwise the file gets transferred to the phone, but the phone doesn't do anything about it. Of course, the transferred file has to be in one of the formats recognised by the phone - in my case it is a SIP/Internet telephone settings file generated by a dedicated piece of software, and the phone automatically offers to import the settings contained in it - but that's a whole other story :-)

Hope the above will lighten the load for someone else :-)


All times are GMT -5. The time now is 04:24 PM.