odyaka341 / nxt-python

Automatically exported from code.google.com/p/nxt-python
GNU General Public License v3.0
0 stars 0 forks source link

[Patch] Support for commuication via device files #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I had trouble getting BlueTooth to work on OS X 10.8 because it seems that none 
of the bluetooth libraries are supported any more.  However, I noticed that 
when I paired my NXT with my Mac it created a device file corresponding to the 
bluetooth serial port.  I whipped up a simple 'socket' class to communicate via 
the device file, and it seems to work.  By default it searches for the first 
device that matches the pattern "/dev/*-DevB" because mine came up as 
"/dev/<BrickName>-DevB"; not sure if that's standard or not.  Anyway, the patch 
is here:

https://github.com/dgchurchill/nxt-python/commit/d3573d36c18064e6250833967c53694
494068456.patch

Cheers,
Dave

Original issue reported on code.google.com by d...@ninthcuriosity.com on 22 Jan 2013 at 11:09

GoogleCodeExporter commented 9 years ago
This is a great patch, thanks for submitting. I've made some revisions to it to 
make it better fit the established API for *sock modules and committed the 
result in r389. Please review the changes with special attention to the `if 
method.device:` block in locator.py and the new find_bricks() and revised 
__init__() methods in devsock.py and let me know if there's anything that 
should be re-revised. I'd appreciate it if you could also test the code as 
committed and make sure I haven't broken anything with my mangling. Thanks!

Original comment by marcus@wanners.net on 2 Feb 2013 at 4:24

GoogleCodeExporter commented 9 years ago
Great, thanks for applying it.  I've tested out r389 and it all looks good.  
Only thing I noticed which I missed originally is that the Motor code warns 
"Warning: Socket did not report a type!".  I think just adding type = 
'bluetooth' to DeviceSocket is the appropriate fix?

Original comment by d...@ninthcuriosity.com on 19 Feb 2013 at 10:44

GoogleCodeExporter commented 9 years ago
Done in r390. Let me know if there are any more issues!

Original comment by marcus@wanners.net on 19 Feb 2013 at 6:52

GoogleCodeExporter commented 9 years ago
Thanks :)

Original comment by d...@ninthcuriosity.com on 21 Feb 2013 at 12:06