Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Create a virtual comm port for my device

If you have a question or need help, this is the place to be.
Post Reply
techdealer
Posts: 1
Joined: Sun Apr 14, 2013 2:51 pm

Create a virtual comm port for my device

Post by techdealer »

I want create a virtual comm port for my device in python.

currently i have this code:

Code: Select all

import win32file
import win32con
import binascii

print "starting"

name = "\\\\?\\USB#VID_07CF&PID_6101#5&15a1c23b&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}"

handle = win32file.CreateFile(
    name,
    win32con.GENERIC_READ|win32con.GENERIC_WRITE,
    win32con.FILE_SHARE_READ | win32con.FILE_SHARE_WRITE,
    None, # no security
    win32con.OPEN_EXISTING,
    0,
    0
)

buffer = win32file.AllocateReadBuffer(2)

err, data = win32file.ReadFile(handle, buffer)
if err == 0:
    print binascii.hexlify(data)
else:
    eg.PrintError("Error")
   
win32file.CloseHandle(handle)

print "finished"
what changes i need do to choose the number of the port that this script should create?
Post Reply