Menu

#118 bt_obex_discover() error 2 if target advertises no services

wont-fix-for-1.4
open
socket (31)
3
2008-01-16
2006-12-05
No

Hi,
I trying to execute this code and I always receive this message:

Error 2, no such file or directory...

I can select my device. I just can connect...

My code is that:

from appuifw import *
from e32socket import *

try:
phone = bt_obex_discover()
file = query(u"File Selection", 'text')
bt_obex_send_file(phone[0], phone[1].values()[0], file)
note(u"File Sent")
except Exception, error:
note(unicode(error), 'error')

I think that the code is OK! Maybe the problem is with Nokia 6681 and Python...

[]'s
Danilo Cesar

Discussion

  • Jiri Popek

    Jiri Popek - 2006-12-06

    Logged In: YES
    user_id=1402590
    Originator: NO

    are you sure you have properly configured COM ports on PC? This occured to me, when I used Windows BT drivers. Everything works fine after switching to drivers shipped with BT device.

     
  • Danilo Cesar

    Danilo Cesar - 2006-12-06

    Logged In: YES
    user_id=1338557
    Originator: YES

    I never needed to configure my ports on PC... But I think that is not this problem...
    When I execute this code, the problem do not occur

    import socket
    sock=socket.socket(socket.AF_BT, socket.SOCK_STREAM)
    target=('00:0C:55:FB:80:D6',4) # bt-address and port
    sock.connect(target)
    sock.send("hello!")

    But, if I change this code to try to find other devices, the problem happens again.
    target= socket.bt_discover()

    And I do not use windows...

     
  • Jukka Laurila

    Jukka Laurila - 2006-12-07

    Logged In: YES
    user_id=1162622
    Originator: NO

    Make sure the target is advertising an OBEX service. The only reason we have found for that error message in this context is that the selected target device does not advertise any services of the searched type.

     
  • Jukka Laurila

    Jukka Laurila - 2006-12-07
    • priority: 5 --> 3
     
  • Danilo Cesar

    Danilo Cesar - 2006-12-08

    Logged In: YES
    user_id=1338557
    Originator: YES

    OK...
    But, I think that you will agree with me. I want just found bt devices around me...
    Look this code now.. I do not try to connect with anybody. I do not try to send nothing....
    But, it still giving me the same error:

    address, services = socket.bt_discover() error: (2,"No such file or directory")

    Its show me bluetooth devices around me. But, when I select then, this error message appear.

    ============Code here==============
    import appuifw
    import e32
    import socket

    sock = socket.socket( socket.AF_BT, socket.SOCK_STREAM )
    address,services = socket.bt_discover()

    print address
    print services

    **************** UPDATE:
    Yes... I need a service running on machine... But, and if I only want to know about a bluetooth adreess?
    I think that bt_discover need to return a address and a empty service... Did you agree with me?

     
  • Danilo Cesar

    Danilo Cesar - 2006-12-08

    Logged In: YES
    user_id=1338557
    Originator: YES

    A rapid solution to this, on linux, run this command:
    sdptool add --channel=3 SP

    It will registar a new service port, and bt_discover will not return a error anymore...
    But, developers: Please.... Make bt_discover return a address field and a empty service in the next version...

    Thanks,
    Danilo Cesar

     
  • Jukka Laurila

    Jukka Laurila - 2007-02-19
    • labels: --> socket
    • assigned_to: nobody --> janimr
    • summary: bt_obex_discover() returning a error --> bt_obex_discover() error 2 if target advertises no services
     
  • Jani Rytkönen

    Jani Rytkönen - 2007-04-19

    Logged In: YES
    user_id=1591731
    Originator: NO

    bt_obex_send_file(phone[0], phone[1].values()[0], file)
    Gives error: Error 2, no such file or directory, if file name or path is invalid.

    btconsole will also give same error if address,services = socket.bt_discover() fails.
    Running it as a script it gives error (0, 'Error') if can't make a connection.

     
  • Jani Rytkönen

    Jani Rytkönen - 2007-04-19

    Logged In: YES
    user_id=1591731
    Originator: NO

    Correction for previous, in device it does give Error 2, no such file or directory
    if Bt_device is on and service can't be started.

     
  • Jukka Laurila

    Jukka Laurila - 2007-06-12
    • milestone: 663691 --> wont-fix-for-1.4
    • status: open --> closed
     
  • Jukka Laurila

    Jukka Laurila - 2007-06-29
    • assigned_to: janimr --> vbartoni
     
  • Jukka Laurila

    Jukka Laurila - 2008-01-16
    • status: closed --> open
     

Log in to post a comment.