This is improved version of pys60usb made by Simo Salminen so all thanks goes to him. I only added new parameters to connect() -function. This is based on the version 20060101. If you find bugs from this version, post them here.
Improved?
Well, now I can connect to PC with my N70 using the same port used by PC-Suite. This was not possible previously without killing the FaxModem process from the device. The connection also caused exceptions all the time when it checked the connection status. Usually the status indicates something that is really not an error so it was hard to use it with simpleusbconsole.py. I did only small changes and it seems to work nicely now. It should raise exception only when cable is disconnected. Should work on both S60 and UIQ.
Note: It seems that with UIQ devices the mRouterRuntime sometimes messes things up and the COM ports are not available on the PC. Try to kill the mRouterRuntime process using task manager.
Download
Sources
Grab the sources here.
Changed files
- python/phone/simpleusbconsole.py
- Tries to find a working access method
- Readme.txt
- symbian/src/bld.inf
- symbian/src/ConnManager.cpp
- symbian/src/ConnManager.h
- symbian/src/pys60usb.cpp
Precompiled
Symbian 70s
pys60usb_pyd_20070610.zip
Just unzip, send to phone and copy the pys60usb.pyd to c:\system\libs\ using FExplorer or some other filemanager. Contains updated simpleusbconsole.py.
Api
Only new stuff here
Attributes
New attributes for defining access mode and connection role see TCommRole and TCommAccess.
- From TCommAccess
- ECommExclusive, ECommShared, ECommPreemptable
- From TCommRole
- ECommRoleDCE, ECommRoleDTE
USBConnection::connect( port=0, port_type=u"ACM", mode=ECommShared, role=ECommRoleDCE )
Previously connect() didn't take any parameters and 'mode' was ECommExclusive.
- port
- Used port number. Some devices have more ports available than others.
- Type: int
- port_type
- Type of the port. I don't know if there are any other than ACM but I parametized it anyway.
- Type: unicode
- mode
- Access mode. See TCommAccess.
- Type: int
- role
- Role of the connection. See
TCommRole - Type: int
Example
import pys60usb
usb = pys60usb.USBConnection()
# Connect to port 1. Works with most S60 3rd devices.
usb.connect( port = 1, mode = pys60usb.ECommExclusive )