JUMP TO SOLUTION Solved

Original topic:

Accessing the virtual serial port

(Topic created: 07-20-2023 09:30 PM)
2268 Views
Fklein23
Constellation
Options
Tablets
 

I am trying to interface a Samsung Galaxy tab A8 Android tablet with an embedded device. I can make the connection with a OTG style USB-C cable and can communicate with the embedded device using the "Serial USB Terminal" app that I downloaded from the Play Store. But I need to connect with a Python app that I installed on the tablet. I know the "Serial USB Terminal" app uses the virtual serial port to communicate with the embedded device. But in order to get my Python application to connect I need to know the name of the virtual serial port. I have used the same Python code to communicate with the embedded device using my PC, but on the PC the port is called "COM6". My Linux system calls it "/dev/ttysUSB1". I need to know what the tablet calls that communication port.

Here is the Python code:

import serial

# Open the serial port
ser = serial.Serial('COM6', 9600, timeout=1)

while True:
    # Get user input
    user_input = input("Enter a string (or 'quit' to exit): ")

    if user_input == 'quit':
        break

    # Send the user input to the serial port
    ser.write(user_input.encode())

    # Read the response from the serial port
    response = ser.readline().decode().strip()

    # Display the response
    print("Response:", response)

# Close the serial port
ser.close()

The only missing piece (since the code works flawlessly on my Windows PC version of python3) is that in the third line of code, the name, "COM6", is an unresolved reference. I have tried every variation I can think of for this port name, but it would be nice if it were documented somewhere.

0 Likes
Reply

1 Solution


Accepted Solutions
Solution
bill-e
Cosmic Samsung Care Ambassador
Options
Tablets

https://forum.developer.samsung.com

** If my response helps, please click on Like (Heart). If I resolved your issue also please click on Accept as a Solution so that others can benefit.

Bill
---
Galaxy Fold 6 512g(VZW), Galaxy Book (original, VZW), Tab S8 Ultra, Tab S4, Galaxy Watch7Ultra(VZW),Galaxy Watch6Classic 47mm(VZW), M8 Smart Monitor, NEO 55" QN90D TV, Buds Pro

View solution in context

2 Replies
LongHiker
Galactic Samsung Care Ambassador
Options
Tablets

@Fklein23 I think you would need to find and post in a developers discussion area. This discussion area is for users of Samsung devices and services. The odds of getting the help here that you are seeking, is going to be low. 

Solution
bill-e
Cosmic Samsung Care Ambassador
Options
Tablets

https://forum.developer.samsung.com

** If my response helps, please click on Like (Heart). If I resolved your issue also please click on Accept as a Solution so that others can benefit.

Bill
---
Galaxy Fold 6 512g(VZW), Galaxy Book (original, VZW), Tab S8 Ultra, Tab S4, Galaxy Watch7Ultra(VZW),Galaxy Watch6Classic 47mm(VZW), M8 Smart Monitor, NEO 55" QN90D TV, Buds Pro