pythonmobileusbserial-portpys60

How do you access a serial port in Python for mobiles?


The serial port must be over USB cable, from the phone to a computer.

In Java, I got it working by using the following code:

CommConnection comm = (CommConnection)Connector.open("comm:USB1");

// Now use comm to read and write data

How can I do this in Python for mobiles, specifically PyS60?


Solution

  • I got this from here:

        import pys60usb
        usb = pys60usb.USBConnection()
    
        # Connect to port 1. Works with most S60 3rd devices.
        usb.connect( port = 1, mode = pys60usb.ECommExclusive )