In my current project I'm quite successfully using the USB Serial Driver; apart from using it for a shell the system also emits various log messages. Now as long as there's a program consuming the transmitted bytes on the other ends everything is well. But it nothing reads from the USB Serial port write operations on the serial driver's sequential stream will block; which is a problem, because if message printing blocks the whole system eventually comes to a standstill.
Now I was wondering if there might be some way to detect if there's actually some program consuming the transmitted bytes on the USB host computer? The next best solution would be, that the USB Serial Driver offered some option to (silently) discard anything queued for submission if the transmit buffer is full (either hard, or by some timeout).
Is either in any way possible?
USB Serial Driver – detect consumer on the other end?
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: USB Serial Driver – detect consumer on the other end?
Hi,
It is not possible, you may try writing on the output queue using a timeout, this way the program would not hang forever, you may try something like 10 milliseconds.
Giovanni
It is not possible, you may try writing on the output queue using a timeout, this way the program would not hang forever, you may try something like 10 milliseconds.
Giovanni
Re: USB Serial Driver – detect consumer on the other end?
Maple has the same prpblem .
Can't you tell if the USB device is enumerated with a host? I would think there is some way to tell...
Can't you tell if the USB device is enumerated with a host? I would think there is some way to tell...
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: USB Serial Driver – detect consumer on the other end?
That is easy, check the "state" field of the USBDriver structure.
But enumerated does not mean that there is an application on the host side consuming the data.
Giovanni
But enumerated does not mean that there is an application on the host side consuming the data.
Giovanni