On 8 Jun, 2012, at 2:16, Mike Wirth wrote: > Hi, folks, > > Newbie (to Python) here. I'm porting a Python app from Windows that talks to > a Bluetooth 2.1 device using the serial profile (on WinXP it shows up as two > numbered COM ports, one inbound and the other outbound) On the Mac, the > device shows up in /dev as: > > crw-rw-rw- 1 root wheel 18, 7 May 30 23:12 cu.BlueRadios-COM0 > > On Windows, the app requires me to install pyserial (and pygame for the > visual output). > > On the Mac, where I've installed and am using python 2.7.3 (rather than the > pre-installed 2.6.7), my app starts up and acts like it doesn't need to have > pyserial installed, but of course, it can't connect to the expected numbered > COM port. > > 1. Do I need the Mac equivalent of pyserial?
pyserial works fine on OSX.
> 2. Or can I just stuff something like '/dev/cu.BlueRadios-COM0' in the app's
> source code where it expects to open the serial port.
Probably. The last time I used pyserial on OSX I just used numeric indexes to
probe for the device:
for pn in range(10):
try:
port = serial.Serial(pn, timeout=0.5)
break
except serial.SerialException:
pass
else:
raise RuntimeError("Cannot find port")
The main advantage for me was that the same code works on Windows as well.
> 3. Anything special about the Bluetooth serial profile (e.g., setting port
> properties)?
I haven't used Bluetooth, with some luck the exposed serial device can be
configured just like any other serial device using pyserial.
There is a low-level Bluetooth framework as well, but I don't know if someone
has writting python bindings for that.
Ronald
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Pythonmac-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
