You are here: Start Linux and Computers Simple Bluetooth Proxy for PyS60 and Linux
Simple Bluetooth Proxy for PyS60 and Linux PDF Print E-mail
Written by Andreas Böhler   
Saturday, 20 December 2008 12:19

I don't own an S60 device anymore, so development on miniproxy has STOPPED!

I recently got a new Cell Phone: The Samsung SGH-i560, which is a Symbian-based device with HSDPA and Bluetooth, but lacks WiFi-support. I thought it would be possible to surf the web via Bluetooth, using my computer's internet connection. Unfortunately, this is not true. So, what to do?

I found two projects, both are abandoned at the time of this writing, trying to provide a fix: GnuBox, which works for every protocol using a special access point, and Hiisi Proxy that is programmed in Java and works only for HTTP, but needs a special Java-Server on the host PC to work.

Why a new Proxy?

GnuBox made my cell phone crash. Same issues as on the E51, it is simply unusable.

Hiisi Proxy works, more or less, but I didn't succeed in setting up the Server on Linux and it is even impossible to use the Server on my Linux-based Router (no Java).

I therefore decided to write my own little proxy: In Python. The Samsung is capable of running Nokia's PyS60 (you have to crack open the firmware first) and my Router is also able to run Python.

So, find my first implementation in the download section! I used YaPN as an example on how to write a Proxy in PyS60.

Notes:

Tested configurations for Server side:
  • Ubuntu 8.10, BlueZ/Python 2.5.2/PyBluez 0.15
  • Windows Vista, MS Stack/Python 2.5.4/PyBluez 0.15
  • Windows XP SP2, MS Stack/Python 2.5.4/PyBluez 0.15

Tested configurations for Client side:

  • Samsung i560 (S60  3rd FP1), Native Stack/PyS60 1.4.5
  • Ubuntu 8.10, BlueZ/Python 2.5.2/lightblue 0.3.3

MacOS X is still untested! On XP, the WIDCOMM-Stack does not work correctly, although it is supported by PyBluez. I'll have to look into this further..

Instructions:

  • Pair your computer and your mobile and set the devices trusted.
  • On the computer, install lightblue or pybluez and run miniproxy_server.py
  • Install Python and Python Script Shell on your mobile phone
  • Create a new Access Point, filling in only the Proxy Server: 127.0.0.1 and the Proxy Port: 1234 and name it for instance Proxy. If you have Hiisi installed, you can also use the Hiisi AP
  • Transfer miniproxy_client.py to your phone's E:\Python drive and run it from within Python -> Run Script. It will ask you to connect to a computer. Select the computer running miniproxy_server.py and then BT Proxy Service as Port.
  • Switch to a Web Browser and enjoy!

Todo:

The proxy implementation is not complete yet.

Correctly support the WIDCOMM-Stack on XP. 

Help:

If you have any comments, suggestions or improvements, please don't hesitate to contact me at andy (dot) boehler (at) gmx (dot) at

Download:

You can download both scripts in the Downloads section.

Changelog:

v0.04, 2009/01/07:

Server: Windows support is now complete, tested only on Vista and XP, Microsoft-Stack only!

Server: Client disconnects are now correctly detected, no need to restart the server on client disconnect

Client: Correctly exit on CTRL+C

v0.03.1, 2009/01/06:

Server: Added better Windows support (not extensively tested!)

Comments (66)
  • Sandun Lewke Bandara

    Nice to be the first commenter on your application.im have used that Hiisi Proxy appication.as you also know that gives Packet data error when try to browse the internet(sm times).
    i did all the steps as you said.it successfully connected with bluetooth serial port.(it said local port opened. on both PC and mobile Python). but this also gave me that Packet data error when try to browse.what the problem dude?

  • andy

    What phone are you using? Do you get this error everytime you try to browse the web or only sometimes as with Hisii?

  • Sandun

    I was using Windows vista.i tried that both Pybluez and LightBlue.i think Lightblue make me to get that output at that time. But now doesnt work. i mean when i run minibtserver.py on vista it disappeared within half second.whatz the wrong with windows vista????

  • andy

    unfortunately, i\'ve never tested the server side on a windows machine, but in theory, it should run.
    The disappearing window usually means a Python error. Are you sure you have pybluez installed? If not, check it out at http://code.google.com/p/pybluez. Lightblue does NOT work on win32 (only Linux, MacOS X and PyS60).

  • andy  - Windows support

    v0.04 should now correctly run on Vista, at least, it does for me (but I did only very basic tests as I don't regularly use Windows)

  • Hiisi

    Hello, Andreas,

    I'm Hiisi, the developer of Hiisi Suite.
    As I wrote at my blog, I stopped developing Hiisi Suite.
    It's an obsolete application.
    So, Hiisi alternative is quite nice!
    But unfortunately, I don't have a MiniBTProxy-compatible PC,
    so I couldn't test it.

    Recently, I've developed a multi-thread capable YaPN clone with PyS60.
    ReadMe file is written in Japanese,
    but I think you can understand how to implement that from its source code.
    http://hiisi-proxy.blogspot.com/2008/12/yayapn-001 .html

  • steve

    i have windows xp.python 2.6 also installed PyBluez
    when i run miniproxy_server.py i'm getting this errors
    Init Server: 0.02
    AssignScnValue
    Traceback (most recent call last):
    File "C:\miniproxy_server.py", line 195, in
    minibtproxy().run()
    File "C:\miniproxy_server.py", line 70, in run
    self.start_bt()
    File "C:\miniproxy_server.py", line 75, in start_bt
    self.start_bt_server()
    File "C:\miniproxy_server.py", line 103, in start_bt_server
    bluetooth.advertise_service(self.bt_socket, 'BT Proxy Service')
    File "C:\Python26\Lib\site-packages\ ;bluetooth\widcomm.py", line 136, in advert
    ise_service
    profiles, provider, description, protocols)
    File "C:\Python26\Lib\site-packages\ ;bluetooth\widcomm.py", line 530, in __rfco
    mm_advertise_service
    self.port))
    File "C:\Python26\Lib\site-packages\ ;bluetooth\widcomm.py", ...

  • steve

    File "C:\Python25\Lib\site-packages\ ;bluetooth\widcomm.py", line 530, in __rfco
    mm_advertise_service
    self.port))
    File "C:\Python25\Lib\site-packages\ ;bluetooth\widcomm.py", line 215, in _sdp_c
    heckraise
    raise BluetoothError ("Invalid SDP record";)
    bluetooth.btcommon.BluetoothError: Invalid SDP record

  • andy

    unfortunately, i've never tested the server side on a windows machine, but in
    theory, it should run. I'll check back on windows support soon!

  • andy

    Please check out v0.04, it fixes many problems with using, possibly also yours related to service advertising.

  • Anonymous

    thanks alot for replying,
    i tried v0.04 ,the pc server works fine
    i see this message
    Init Server: 0.04
    AssignScnValue
    waiting for connection
    but after i run the phone client then try to connect to my pc it crashes :(

  • andy

    Please give me some more details about your setup: What OS are you using (XP is still untested)? Which Bluetooth-stack are you using? What version of Python/which version of PyBluez/lightblue? What PyS60 are you running on which phone?

    "AssignScnValue" is no specific message from minibtproxy, but from an underlying system.

  • andy

    OK, I did some more tests on XP: It works correctly using the Microsoft stack, but with the WIDCOMM-Stack the problems mentioned by you are observed. ATM I don't have the time to look into this, but it's on my ToDo. Sorry for this!

  • Kai

    Hello,Andreas!
    I`m using eric4(python IDE) with pybluez ver. 0.9.2 to run server, and nokia n80 with python ver. 1.4.0final to run client. i have created an access point named "Proxy" with these options:
    Connection name: Proxy
    Data bearer: Packet data
    Access Point Name: none
    Username: none
    Password: none
    Authentication: secure
    Network type: IPv4
    Phone IP: automatic
    DNS: automatic
    Proxy: 127.0.0.1
    Proxy port: 1234

    client and server are connecting without errors, but when i`m trying to open a webpage using connection "Proxy" phone says "Packet data: Packet data connection not available". Many users are experiencing the same error(i have read comments about minibtproxy on several sites). Could you please give me any advise what should i do?
    Thanks,
    Kai

  • andy

    Unfortunately, I've never experienced a problem like yours. I think (and this is a guess!) that some S60 phones simply can't use a Proxy without available Packet Data Service.
    Could you point my to some of the comments on other sites you mentioned via E-Mail?

    Thanks

  • Kai

    Sorry, but i havent found your email. Could you tell me it please?

  • andy

    Sorry, I thought you can just click the letter symbol to send an e-mail, but unfortunately, that's not true.

    My Mail is: andy (dot) boehler (at) gmx (dot) at

    Thank you

  • Anonymous

    I'm using
    Windows xp sp2
    Widcomm bluetooth
    Python 2.5.2
    PyBluez-0.15
    Python 1.4.4 on phone
    i think the problem isn't the miniproxy client
    it's PyBluez that makes it crash
    coz after i installed PyBluez the bluetooth console option which comes with Python 1.4.4 also crashes

  • andy

    OK, thanks for this information! As mentioned above, you can use the native XP stack in conjunction with PyBluez.

  • Kai

    Hello,Andreas!
    In order to make access point work, you should write there your provider`s APN, login and password. But all data will go through the proxy, not gprs.
    But this way works only with opera mini browser. Do you have any idea how to make it working in other apps, e.g standard s60 browser?

  • andy

    I don't need to specify anything in the APN settings, except for the Proxy Host and Port. I'll add a note that on some handsets it is necessary, to specify more settings.
    This method works for me on Opera, Opera Mini, Google Maps and also the built-in Browser. However, as there are so many different models out there, I can't tell you the different caveats of each model.

  • Domjan

    Hi! This seems like a wonderful app (considering I am a Linux user) but I am not able to make it work on my Nokia 6124 classic (should be the same as 6120).
    Both the server and client seem to work ok but I get the already mentioned 'Packet data error'. I even tried to make a copy of my GPRS connection and change the proxy but then the connection still uses the GPRS and not the bluetooth (only Opera mini, built-in browser receives no data). Any ideas?

  • andy

    Hm, have you ever tried using GnuBox or HiisiProxy?
    If not, please give HiisiProxy a try. If you receive the same error with HiisiProxy, it seems to be a problem of this specific model/firmware.
    Unfortunately, as I already mentioned above, I can only test MiniProxy on my Samsung phone.

  • Domjan

    Haven't tried hiisi or gnubox but according to hiisi related forums a lot of people have this problem. It seems to really be firmware/model related. :(

  • Fred  - Good job

    Thank you for this app.

    When I run the client script, I receive the error :
    AttributeError : 'module' object has no attribute 'bt_discover'
    Connection with "Bluetooth console' shipped with Python for Symbian is OK. My laptop is set as default server.

    Nokia 5800 - Python_1.9.1_3rdEdFP2.sis (and Shell equivalent)
    Ubuntu 8.10 - up to date.
    Same error with Hiisi.

  • Fred

    My bad. With the correct python version, i don't have the error anymore.
    But my browser says "no data packet connection".
    I think the problem is in my linux box, but I can't find what.
    The miniproxy_server says Init Server: 0.04
    and waits.

  • amater

    Pod Linuxom to ide.Vo windovse to nejde, treba nejaky MS stack.Vie niekto kde sa da stiahnut?

  • amater

    Nestracajte s tymto softom cas.Ani v spojeni s linuxom to nechodi poriadne.Lepsie pracuje HiisiSuite ibaze k tomu treba nainstalovat Javu (je to batoh 100MB).

  • Anonymous

    teşekürler

  • Johnny

    Nice job with this script andy it`s working great for me. I`ve tried on nokia E51, Windows XP SP3, MS Stack, but i didn`t made a packet data AP, i`ve made a wireless ap in ad-hoc mode.(excuse my english). Keep up the good work. :woohoo:

  • Diogo  - Works on N95

    It works on N95 + Ubuntu 9.04, but I have to create a Wireless AP in Ad-Hoc mode.
    Great piece of software. Congratulations and thank you! :D
    Regards from Brazil

  • Rene Castberg  - Working on 5800XM with Python 1.9.4

    Hi,

    Just wanted to thank you for you appliacation, i have managed to get this program to work with python 1.9.4 on a 5800 Xpress Music.

    I added the following code to the start of the progra:
    import sys

    try:
    sys.modules['socket'] = __import__('btsocket')
    except ImportError:
    pass


    (Code i got from the nokia forum website, it should supposidly work with the 1.4 series but i haven't checked.

    For those with the no data packet connection problems, i got around this by coping my packet data accesspoint and adding the proxy information. 0 bytes transfered over the packet connection.

    Thanks

    René

  • Eurif  - OK for Nokia 5230!!!

    Hi,

    Many thx for your application!

    v0.0.4 works with Python for S60 and Python Shell Script v1.04(2) (aka v1.4.2) on Nokia 5230. It's important to know since MiniBTProxy code does not work with all Python version.

    From the server side, I'm using Ubuntu 9.10 (Karmic) with the native Python version (v2.6.4).

    As mentionned by Rene, above, you need to copy/paste you Internet or WAP access point (or simply modify the proxy settings of your Internet/WAP access point using the 127.0.0.1 port 1234). Because, a connection to Internet (UMTS, GPRS, ...) is needed prior to get access through MiniBTProxy. As I know, an Internet/WAP access without data transfer is no cost so no worry (please, double check this statement from your side).

    By the way, Hiisi also works on Nokia 5230 (same remark regarding mandatory Internet/WAP).

  • Asad  - everythng OK but when i start brows an error comes

    hello Andy l z help me m ;
    suffusing with this problem last many weeks .

    " Web unable to connect . check connection setting "

    i have Adsl 1MB connection.
    in my Adsl router configuration firewall is on.
    my Adsl tcp/ip seting is:

    192.168.1.45
    255.255.255.0
    192.168.1.1

    203.99.163.240
    292.125.132.12

    and i have enable the internet connection sharing of my Adsl local area network.and i have disable my firwall.

    i m using XP .
    bluesoleil 5.0.5 blue-tooth software.
    nokia 6630 .
    my nokia setting same as according to u mention here...

    when i start miniproxy_server.py it runs and quickly disappear..

    when i run miniproxy_client.py in my nokia 6630 with py 1.4.5 final then it runs and connected with PC and shows "Local Port Open"

    then i open default brows and open web then i got error

    " Web unable to connect . check connection setting "

    even UCweb and opera 8.65 also not connecting.
    in [ast i try Hiisi and gnubox but no one worked.

    but hiisi give me same ...

  • Antonio  - Greetings

    Greetings from venezuela, i test your app and works fine but i still having the packet connection problems. Im using my apn name in the right field but it still using my gprs connection and lose all my credits :angry: . Anyway thanks for the app, i hope you can fix it and make it works right.

    Windows 7
    Nokia 6210 Navigator
    Python 2.6.2
    Python Shell S60 1.4.5

  • steve  - This is proably gna sound dumb but...

    Hi, I have a s5230 (tocco lite) and want to try this out, but I can't find a version of python I could use - I can only run jar files not sis, any help?

  • Andreas Böhler

    Sorry, your phone is not an S60 phone and thus can't run this proxy!

  • Holleke  - Config on Nokia E71

    Hi,
    1. Many thanks for this tool! I was loosing lots of time trying to connect my Nokia E71 to Internet trough BT, using Hiisi/Pihantonttu or Gnubox. Nothing. But with your MiniBTProxy, it works !

    2. Installation & Configuration: everything exactly as you describe.
    EXEPT point "Create a new Access Point"
    As others users found out (thanks to them!), in Instruments/Settings/Connections/Access Points/Options-New:
    Name: whatever name
    Data carrier: NOT "Packet-Data" BUT "Wireless LAN"
    WLAN-networkname: I used the name of my desktop-workghroup (MsHome) (I think: whatever)
    WLAN-networkmodus: Not (default) "Infrastructure" BUT: "Ad-hoc".
    Let other fields as they are.
    Then, in the same windows: Options/Adv.settings: Fill here the Proxyserveraddress= 127.0.0.1 and the ProxyPortnumber=1234, as described higher.

    Now I can use the default-webbrowser or Opera-webbrowser (better) on my Nokia E71, update the weatherforecasts, etc. Fine, thanks!

  • shena

    Many thanks for this detail now it is working fine in nokia N95 8gb but it not working in im clients and mobile dialer it showing error registration failed

  • Andreas Böhler

    This "trick" can only work for applications using the HTTP protocol. Normally, IM clients use their own methods to directly connect to the server and therefor cannot be used with a Proxy!

  • Mark

    Thank you sir!

    Honestly, I just accidentally came up with your site for desperately wanting Hiisi and Gnubox to run. I've tried your steps for a couple of weeks ago, unfortunately no luck.

    However, out of the blue, I tried again the steps in Hiisi for the nth time with my N5230, and for whatever reason it runs now!

    And so did I remember this miniBTproxy of yours and give it another try, and to tell you, it works now and I can say it's better than Hiisi! :woohoo:

    I've been wanting this BT ICS to run since last year, but with the complex instruction of gnubox, I stopped looking for alternatives.

    Sorry for the long post, I just wanted to extend my gratitude for you Andreas Böhler! :cheer:

    Thank you so much!!

  • michael  - Getting it working with S60v3FP2 without WiFi

    Some people have posted the trick here of creating an ad-hoc network to "trick" the phone into working with this software. If you have a phone that lacks WiFi, this trick does not work!

    So, to work around it, you need to copy the Access Point name (APN) from your provider's "Internet" connection type, and create a new one with these settings, only setting the IP address and proxy to 127.0.0.1 in the advanced settings, and the proxy port to 1234.

    A connection will be established to your provider for data, however no HTTP data will be transferred on it. Be aware that HTTPS and other protocols (like IRC, MSN) may still try to send data across this connection, and either send the data over the internet or just fail to operate. This proxy lacks HTTP CONNECT support so you can't use those protocols with it until the author adds this support.

  • Dev  - Thanks a lot Andy

    Dear Andy

    Thanks a lot for this app.
    For a couple of months i have trying very hard with gnubox and Hiisi.
    And today I tried your app.I was successful to a certain extent.However i am still not able to browse. I have a Nokia N73 and have Win 7 32 bit and using bluesoleil. I downloaded Python 2.6.4 (from http://www.python.org/download/releases/2.6.4/) and PyBluez-0.18.win32-py2.6.exe (from http://code.google.com/p/pybluez/downloads/list). installed both of them. then i ran the miniproxy_server.py .A kind of a black screen flashed and disappeared.(unlike Hiisi if you ran the pihantottu the proxy came up with a window). Anyways after that i downloaded PythonForS60_1_4_5_3rdEd.sis and PythonScriptShell_1_4_5_3rdEd (from http://www.dotsis.com/mobile_phone/showthread.php? 190219-Phyton-v1-4-5-s60v3).I did run the script from Python and connected to my PC. A message came up on my PC stating that the mobile has successfully connected to Port 15.
    Also i have created the access pointed as ...

  • Anonymous  - re: Thanks a lot Andy

    I'm very sorry, but the underlying PyBluez-Framework simply does not support Bluesoleil, only the native stack and WIDCOMM are supported!

    However, I came up with an idea and will probably release a new testing version soon. Stay tuned!

  • Dev  - Thanks for your reply

    Hi

    Can you please let me know something more abt "native stack". Also i have tried earlier with the Widcomm and Hiisi and Gnubox. and i was unsuccessful with both of them.I kept on getting the error - Nokia N73 has disconnected from my bluetooth Serial Port(Com8).

    I am waiting with my fingers crossed for your support on this issue.

    Thanks and Regards
    Dev

  • andy

    With "native stack" I refer to the Microsoft Stack that is built into Windows.
    The version I am currently working on will just use the serial port emulation provided by whatever Stack you have installed, so in theory it should support all Stacks that provide a serial emulation. I'm testing this on Windows 7 using the Toshiba Stack.
    The currently available version uses pybluez to do the Bluetooth-Communication, therefore it relies on the few stacks supported by pybluez.

    I did some initial testing today and it doesn't seem too difficult to get it to work with the Toshiba stack. Give me some more days and I'll post a new version!

  • FAbio  - Change in protocol

    Hello there!

    I am currently doing my master thesis on Bluetooth and your proxy worked great for me!
    Just, I would like to know if it's possible to have a version working on other protocols than http, especially RTSP, that is what i need to test (video streaming over BT)

    Can you help me?
    thanks a lot

  • Sanchomld  - Not work on widcomm

    XP SP2 widcomm... After i connect to server, client crush... pls help... native XP stack not found :s

  • Sanchomld

    All ok, finaly BUT. Its work only on N5230 standart browser, if i try to connect via Opera mobile 10 - Client disconect -> reset BT socket !!! If i use opera mini or another browser - is use my provider trfic (not PC)... Can help me? Sorry for my english :)

  • Mark

    Sanchomld,

    I also use N5230. It works fine on default browser, I also use it in Opera Mobile 10. Just set the configuration proxy to 127.0.0.1

    I'm not quite sure though, It's been a while since I used it.

  • Sanchomld

    Hmm, strange. But in opera 10 config i not see proxy server. If you mean AP - i set. If i open any link in opera = client restart -> reset BT socket. + in standart N5230 browser this error appear sometimes. And one more question - why internet via Bt is so slow? (high speed only for downloads).

  • Mark

    I'm sure there's a section there for Proxy settings, you can set the local proxy to 127.0.0.1

    The HTTP one, there's http ftp and https. I'm not really familiar into it sorry..

    Yeah, I have 1mbps connection. It's quite fast, compared to my GPRS/3G connection, however sometimes it tends to disconnect and I need to restart my Python (phone client) again to connect via bluetooth.

  • Sanchomld

    Bluetooth v 2.0 = 100 kbps max ?! cuz i have 10 mbps on PC but on phone 50-100 kbps...how can i get 1 mbps?

  • andy

    The problem is not only the BT connection, but also the way the proxy works. The proxy does not support more than one concurrent connections and has to buffer every connection two times - this costs a lot. I *do* have some plans and ideas to improve the proxy, but unfortunately my S60 phone is being repaired right now!

  • Kristof

    Andy,

    Any outlook on the new version? I like the concept a lot, but the current implementation, because of the reasons that you describe, is rather slow.

    Looking very much forward to the new version!

    Let me know if you need some help.

    Kristof

  • Sanchomld

    Ok,i'll wait new version. Cuz i cant config GnuBox on my N5230(i dont like Hiisi). Thx :)

  • Baldman

    Just a couple of questions.
    1. Maybe somebody knows how to to get working miniproxy_client on python 2?
    2. Maybe somebody knows how to get working miniproxi_server with BT stack other that that of microsoft?

    Thanks in advance.

  • Kristof

    In python 2, the socket module of the previous PyS60 releases has been renamed as btsocket.

    If you update the script to reflect this change, it works (it works for me, using python 2 on N5230 with Vista).

  • Sanchomld

    1.4.5 scripts will never work on 2.0 ! ;)

  • Baldman

    I know, but maybe it's possible to make new version working on 2.0 either?
    And what about non-MS stack? I have a couple of dongles but no one works with MS stack unfortunately.
    I'll wait for new version. Ang big thanks for your efforts.

  • Mauricio  - Issues in Nokia 5730

    Hello!

    Thank you very much for developing this program!

    I wanted to ask you, do you know why in the native browser it works OK, but opera mobile doesn't work at all?

    I lost my connection everytime I attempt to connect through opera mobile. And there is no way of restarting the client script than reseting the phone, and opening python again. Why is this issue going on?

    Also, I noticed there isn't SSL support, right?

    Thank you very much!

  • andy

    Right, SSL is not and probably will never be supported, as this requires the implementation of the CONNECT method.

  • andy  - Development Stopped

    Thank you all for your feedback and wishes. I'm very sorry, but development on miniproxy has been stopped. My S60 phone is dead and I switched over to webOS!

    If someone wants to donate a phone, I can continue development. However, without such a phone my motivation for this proxy is gone, as the Palm Pre features WiFi.

  • atommixz

    but, where is modified files? :(

Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):S
:!::?::idea::arrow:
Security
Please input the anti-spam code that you can read in the image.
Last Updated on Monday, 10 May 2010 13:31
 
Template is Powered by www.schaffenskraft.info © 2008 | CSS 2.1 | XHTML 1.0