简体   繁体   中英

'ignore' DTR on serial connection

I am developing .NET core 3.0 windows / linux app that uses serial ports to communicate with multiple types of printers (fiscal printers).It is working well for multiple devices, but one of them has a driver that does not implement the DTR functionality.

So if i write a code in C that does not set DTR at all, the application works, but if i open a serial connection from .NET Core, the framework sets DTR to false and then a error occures: "a device attached to the system is not functioning" in the set_DtrEnable method.

Is there any way to open a serial port in .NET Core and leave that setting alone? Any ideas on how to overcome this issue? There is always a hack/slash approach of writing a small C app and run all communication through it, but it seems like using a shotgun to hunt for mosquitoes.

[edit:] the device has a builtin USB to serial adapter which causes the problem.

The following measures can be considered.

  1. Notify the device vendor and have the device driver corrected.

  2. If the error can be caught with try catch and other functions continue to be used after the error occurs, the error is ignored.

  3. Exclude support for such printer/device drivers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM