I am using com0com and pyserial. I open one port, write to it using pyserial and read from it in the YAT emulator. This works great. Can this setup be used to simulate unplugging of a usb device that is emulating a serial port? I want to recreate a UnauthorizedAccessException that is rarely thrown by real devices in our application software upon unplug. After writing to CNCA0 using pyserial and reading from CNCB0 using YAT successfuly, I tried to close CNCB0 from pyserial and of course it wouldnt let me because port is already acquired by YAT (Access is denied). Any ideas about how to simulate an unplug action of a real device?
com0com and pyserial virtual serial ports. Can this be used to simulate unplugging a serial usb device?
2.3k Views Asked by Impostor Syndrome At
1
There are 1 best solutions below
Related Questions in PYTHON
- How to store a date/time in sqlite (or something similar to a date)
- Instagrapi recently showing HTTPError and UnknownError
- How to Retrieve Data from an MySQL Database and Display it in a GUI?
- How to create a regular expression to partition a string that terminates in either ": 45" or ",", without the ": "
- Python Geopandas unable to convert latitude longitude to points
- Influence of Unused FFN on Model Accuracy in PyTorch
- Seeking Python Libraries for Removing Extraneous Characters and Spaces in Text
- Writes to child subprocess.Popen.stdin don't work from within process group?
- Conda has two different python binarys (python and python3) with the same version for a single environment. Why?
- Problem with add new attribute in table with BOTO3 on python
- Can't install packages in python conda environment
- Setting diagonal of a matrix to zero
- List of numbers converted to list of strings to iterate over it. But receiving TypeError messages
- Basic Python Question: Shortening If Statements
- Python and regex, can't understand why some words are left out of the match
Related Questions in WINDOWS
- how to play a sounds in c# forms?
- Echo behaviour of Microsoft Windows Telnet Client
- Getting error while running spark-shell on my system; pyspark is running fine
- DirectX 9 With No SDK Installed - How To Translate a D3DMATRIX?
- Gradle 8.7 cannot find installed JDK 22 in IntelliJ
- 'IOException: The cloud file provider is not running', when trying to delete 'cloud' folder
- Cannot load modules/mod_dav_svn.so into server
- Issue with launching application after updating ElectronJs to version 28.0.0 on Windows and Linux
- 32-bit applications do not display some files in Windows 10
- 'bun' is not recognized as an internal or external command
- mkssecreenshotmgr taking a screenshot
- Next js installation in windows 7 os
- Can't resize a partition using Mini Tool?
- Is there any way to set a printer as default according with Active Directory Policy Security Group and PC hostname?
- Electron Printing not working on Windows (Works on Mac)
Related Questions in SERIAL-PORT
- Nonin Oximeter 3231
- How would I go about filtering non-standardly formatted serial data which contains some junk binary between data entries?
- SerialPort timeouts in ReadChar() method, WPF, "The operation has timed out."
- Rust tokio_serial: async fn readable does not block execution. Runs with 100% CPU load
- Why is there a large ploting delay/lag in my real-time serial port ploting app after more than 10000 datapoints reading?
- I get "DevTools was disconnected from the page" error when connecting Arduino to the computer and switching between tabs
- RS422 communication using PySerial (Raspberry PI)
- Python script becomes unresponsive at 100% CPU usage (single core)
- Redirecting stdin and stdout to the same device in shell
- C# System.IO.Ports throws System.IO.Ports is currently only supported on Windows, but i'm currently using windows
- C# COM Port slowing down to read one byte a second after sending message
- What are the differences between a windows serial port and a macos serial port using NodeJS?
- How to increase baudrate on Device Manager Windows?
- Nextion with Arduino change text
- no console after using :wq in vim
Related Questions in PYSERIAL
- How to fix python serial monitor parsing error?
- Raspberry Pi sending/receiving data over usb
- How do I do a proper if statement with data from a serial device in python?
- RS422 communication using PySerial (Raspberry PI)
- My RAMPS1.4 doesn't work when controlled by RPI5 via Python3
- ModuleNotFoundError: No module named 'pyfirmata'
- Baud rate issue in Raspberry Pi 5 and Arduino connection with USB in Python3
- Computer Locking Up While Using PySerial
- Python serial communication causing high CPU Usage when baudrate is 1000000
- How can I set Xofflimit and clear RTS in pyserial?
- PySerial Benq projector communication
- Can't open serial monitor while pyserial script is working, using nodemcu
- Problem using a mapped baud rate with pySerial
- Python decoding data from serial port and storing into a list
- pySerial reading and writing with arduino
Related Questions in COM0COM
- C#: Wrapping SerialPort.BaseStream in StreamReader seemingly unable to deal with only CR as NewLine
- Creating A Virtual RS-485 Null Modem
- Creating a pair of virtual serial ports within a Docker container
- Serial Port Communication problem while using UART
- Com0Com create ports from command prompt
- Any way to lockdown a virtual comm port to a specific baud rate?
- How to make com0com ports appear as real physical port?
- UWP doesn't connect to virtual serial port
- Unresponsive Windows if nothing is picking up COM port data
- com0com virtual port does not open by UWP
- Creating a pair between a real and virtual serial port
- com0com and pyserial virtual serial ports. Can this be used to simulate unplugging a serial usb device?
- Accessing virtual com ports inside a WS2016 docker container
- Closing Windows (virtual) Serial Ports - how long does the OS take to free them?
- Setting com0com friendly names
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Unauthorized access is simple to replicate. Open up the port with another application, perhaps in another YAT tab. When you try to connect with a different application, you should get an unauthorized access error. However, I'm not sure if that is really the question you are asking.
If you really want to emulate a port disconnect you should realize that you are also at the mercy of the serial driver. Different drivers will behave differently on sudden device removal. What I'm saying is that you can trick yourself into thinking you have a bullet-proof exception handling process when in reality, all bets are off.
I did some experimenting with some of the com0com change commands and nothing I did could cause the port to "virtually disconnect". See the setupc.exe command >help for more info on what is available.
You might also be interested in playing with the emulated noise feature. Open the command shell for com0com and execute
The value is a percentage chance of corruption of the data stream. Fun stuff.