[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Adding Wii Remote support to pygame



Jakub Piotr CÅapa wrote:
Luke Paireepinart wrote:
I was considering using the pySerial module, because I hear you can use this to communicate with bluetooth devices as well.
I couldn't get the Wii remote to register a COM port, though, (through the windows Bluetooth stack manager thing). It seems to me that the way pySerial would interface with the device is that windows has some intermediate layer that pretends to be a serial port but actually forwards all communications from this 'virtual' port to the bluetooth device.
Does anyone know if this is correct?
Do you have to have the bluetooth device pretending to be a serial device in order to use pyserial to communicate with it?

I'm afraid ot's serial-over-Bluetooth and not the other way around. So you can get a serial port device connected via Bluetooth (like most mobile phone modems do) but you can't interface an arbitrary Bluetooth device via a serial port.
Oh, okay. That explains it. The example of serial-over-bluetooth that I was looking at was for interfacing with some kind of Nokia phone.
No wonder.
Okay, I guess there will have to be another way of going about this.
At least that explains why the Microsoft Bluetooth stack wouldn't let me register it as a serial device!
Thanks for this info.

Perhaps I'll try to write a C-module that can do this and wrap it in Python? I'm not really sure where to go from here.

Is there anything similar to libusb (a crossplatform library for talking to arbitrary USB devices from userspace, i.e. with out writing your own device drivers) for Bluetooth? Using such a thing would be a way to implement this.
I'm really confused by this, but I've sort of got the impression that Bluetooth and USB behaved the same as far as HID drivers went...
I.E. the OS hides the fact that it's Bluetooth, and the same driver would work for either a Bluetooth or a USB version of the same input device.
However, I'm not sure if this is true.


Anyway, I don't know if you can use HID drivers to talk to the Wii remote, I don't think you can extract all the info that way,
I think you have to use L2CAP in order to get the info.
The PyBluez module implements rfcomm in Windows, but it doesn't have support for the L2CAP mode that the Wii remote needs.
It seems to me like they're trying to support everything on Windows that they've supported on Linux, but I'm not sure.
I did manage to communicate with the Wii remote using pyBluez, and got a list of services and everything.
Just can't actually get the data from it after that.


I'll look for a library for communicating with arbitrary Bluetooth devices on Windows.

Bluetooth support seems to be an area where Windows is severely inferior to Linux.
At least as far as people implementing support for custom devices is concerned.