Git Product home page Git Product logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
It turns out you manually need to install libusb. Now I have a different error:

>>> b = nxt.locator.find_one_brick(debug=True)
Warning: Config file (should be at /Users/pepijndevos/.nxt-python) was not 
read. Use nxt.locator.make_config() to create a config file.
Host: None Name: None Strict: True
USB: True BT: True Fantom: False FUSB: False FBT: False
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nxt/locator.py", line 119, in find_one_brick
    info = b.get_device_info()
  File "/Library/Python/2.7/site-packages/nxt/brick.py", line 27, in poll
    self.sock.send(str(ogram))
  File "/Library/Python/2.7/site-packages/nxt/usbsock.py", line 69, in send
    self.handle.bulkWrite(self.blk_out.address, data)
  File "/Library/Python/2.7/site-packages/usb/legacy.py", line 148, in bulkWrite
    return self.dev.write(endpoint, buffer, self.__claimed_interface, timeout)
  File "/Library/Python/2.7/site-packages/usb/core.py", line 610, in write
    intf = self._ctx.get_interface(self, interface)
  File "/Library/Python/2.7/site-packages/usb/core.py", line 153, in get_interface
    cfg = self.get_active_configuration(device)
  File "/Library/Python/2.7/site-packages/usb/core.py", line 169, in get_active_configuration
    raise USBError('Configuration not set')
USBError: [Errno None] Configuration not set
Failed to connect to possible brick
Bluetooth module unavailable, not searching there
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/nxt/locator.py", line 137, in find_one_brick
    raise BrickNotFoundError
nxt.locator.BrickNotFoundError

Original comment by pepijndevos on 25 Nov 2011 at 12:40

from nxt-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Finally, running Python in 32 bit and issuing

b = nxt.locator.find_one_brick(debug=True, 
method=nxt.locator.Method(fantomusb=True, usb=False))

it worked, but now and then it returns an error on connecting.

Traceback (most recent call last):
  File "latency.py", line 7, in <module>
    b = nxt.locator.find_one_brick()
  File "/Library/Python/2.7/site-packages/nxt/locator.py", line 112, in find_one_brick
    for s in find_bricks(host, name, silent, method):
  File "/Library/Python/2.7/site-packages/nxt/locator.py", line 69, in find_bricks
    for s in usbsocks:
  File "/Library/Python/2.7/site-packages/nxt/fantomsock.py", line 109, in find_bricks
    nxt = d.get_nxt()
  File "/Library/Python/2.7/site-packages/pyfantom.py", line 267, in get_nxt
    Status.check(status)
  File "/Library/Python/2.7/site-packages/pyfantom.py", line 188, in check
    raise FantomException(description)
pyfantom.FantomException: error -4000ffc2 (hex

Original comment by pepijndevos on 25 Nov 2011 at 2:20

from nxt-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Sorry it took me a while to get back to you. I'm not sure what's up with the 
pyusb/libusb error. You might try pulling the code from nxt.usbsock.USBSock's 
connect() and send() methods and running it by itself to see if you can 
duplicate the error. If so, ask the pyusb people and see if they can help you.

As for the pyfantom exception, talk to Tat-Chee Wan or Nicolas Schodet, the 
developers of pyfantom. It also looks like your traceback may be incomplete, so 
please check that out before sending it along.

Again, my apologies for taking a while to reply. For now, I don't believe that 
there is a problem with nxt-python itself (as it works with linux and the API 
for pyusb should be the same on both systems), so I'm going to mark this as 
Invalid.

Original comment by [email protected] on 5 Dec 2011 at 8:54

  • Changed state: Invalid
  • Added labels: OpSys-OSX, Priority-Low, Series-2.x, Type-Other
  • Removed labels: Priority-Medium, Type-Defect

from nxt-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
It would nevertheless be a good idea to move to the new API. It doesn't look to 
difficult, except that I have no idea about devices, interfaces, endpoints and 
descriptors.

Why are you storing config[0] but setting config[1]? What is connect doing in 
plain english?

This seems to be the same problem as 
http://code.google.com/p/nxt-python/issues/detail?id=33 which is mentioned in 
the source. Maybe the same solution applies to Mac?

Original comment by pepijndevos on 12 Dec 2011 at 11:47

from nxt-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Hm, apparently that's not the solution either, but it does give a different 
error.

>>> import nxt.usbsock
>>> b = nxt.usbsock.find_bricks().next().connect()
>>> b.get_battery_level()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/nxt/brick.py", line 29, in poll
    igram = Telegram(opcode=opcode, pkt=self.sock.recv())
  File "/Library/Python/2.7/site-packages/nxt/usbsock.py", line 73, in recv
    data = self.handle.bulkRead(self.blk_in.address, 64)
  File "/Library/Python/2.7/site-packages/usb/legacy.py", line 159, in bulkRead
    return self.dev.read(endpoint, size, self.__claimed_interface, timeout)
  File "/Library/Python/2.7/site-packages/usb/core.py", line 654, in read
    self.__get_timeout(timeout)
  File "/Library/Python/2.7/site-packages/usb/backend/libusb10.py", line 541, in bulk_read
    timeout)
  File "/Library/Python/2.7/site-packages/usb/backend/libusb10.py", line 641, in __read
    timeout))
  File "/Library/Python/2.7/site-packages/usb/backend/libusb10.py", line 403, in _check
    raise USBError(_str_error[ret], ret, _libusb_errno[ret])
usb.core.USBError: [Errno 60] Operation timed out

Original comment by pepijndevos on 12 Dec 2011 at 12:00

from nxt-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
I agree that we should move to the new pyusb API. However, making the 
modifications to the usbsock module would be hard for me to do. Doug Lau wrote 
the original communications backends and we haven't messed with them very much 
since. I don't have much experience programming for USB devices and none with 
pyusb (I have a tendency to stick to the standard serial interface and let the 
kernel do the hard work). I'm willing to land a move to the new pyusb API in 
v2.3 since there shouldn't be any nxt-python API breaking, but I don't have 
time to figure out how to port it myself at the moment. Even if I did, I have 
no way of testing on macs and testing on windows would be a pain.

So I'll put it on my list of things to do eventually. If anyone wants to do the 
heavy lifting themselves, you'll have my support and feedback, and I'll do the 
best I can to get it tested.

Not sure what's going on with your E60 timed out. Looks like the connect() and 
write() for the request for an input voltage reading works fine and then it 
fails when trying to read the battery. If you want to see what's going on, set 
the USBSock's debug attribute to True before calling connect() and 
get_battery_level(). My guess is that because the handle is reset(), the 
request is dropped somewhere or otherwise doesn't make it to the brick and as a 
result, there is no reply so the recv() times out. As I said, I'm not an expert 
at the USB code, so I'm not sure exactly what's going on or why this is.

Original comment by [email protected] on 12 Dec 2011 at 7:58

from nxt-python.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024

Check this:

https://code.google.com/p/nxt-python/issues/detail?id=54

Original comment by [email protected] on 21 May 2013 at 10:00

from nxt-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.