qzind / qz-print

Archive for legacy qz-print versions (1.8, 1.9). See https://github.com/qzind/tray for modern versions.
Other
141 stars 101 forks source link

Close Open Serial Ports on Disconnect #73

Closed tresf closed 9 years ago

tresf commented 9 years ago

With QZ Tray, if the web browser is abruptly closed while a serial port is open a "port busy" error occurs. Detailed description below:

Once QZ is ready I automatically open the port and start polling it every 1 second. When the shipping employee finishes adding his packages, he clicks the print button which closes the port and sends off the data. Repeat 100x a day. Problem is, if he opens the shipping window and then closes it without printing any labels, the port doesn’t get closed and it throws a Port is Busy error next time he goes to create a shipment.

I tried adding some logic in so that on page load once QZ is ready, it fires of qz.closePort() waits a few seconds, then fires off qz.openPort() and goes about its business, but that doesn’t seem to be working either.

Any tips from other users on how they’re handling situations like this?

tresf commented 9 years ago

Closed via https://github.com/qzind/qz-print/commit/b639214d97ebf98448abf6ef3c0e4a3a5df7f3c8

QZ Print had this logic, but it was never carried over to QZ Tray.

This fix will be available with 1.9.4. For the interm, you can get the fix here:

https://github.com/tresf/qz-print/releases/tag/v1.9.3-patch3

-Tres