Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB printer not detected on windows 10 #1

Open
nirvitarka opened this issue Dec 7, 2023 · 8 comments
Open

USB printer not detected on windows 10 #1

nirvitarka opened this issue Dec 7, 2023 · 8 comments
Assignees

Comments

@nirvitarka
Copy link

I added "Device Instance Path" from device details for the printer.
While printing from this application, it says printer <PATH_OF_MY_PRINTER> not found

The printer path is
USBPRINT\ZEBRA_TECHNOLOGIES_ZTC_ZD230-203DPI_ZPL\6&32827A83&0&USB001

How to set path of usb printer on windows? Is this the correct way of setting the path for windows OS?

@enoy19
Copy link
Owner

enoy19 commented Dec 7, 2023

Hi @nirvitarka,

How have you setup the printer in the Printers page?
You need to add a new serial printer and enter your printer path in the "Path" input field.

@nirvitarka
Copy link
Author

Thank you for the response @enoy19 .
I am able to save printer from the "Printers" page but the issue is about the "Path" of printer on that screen.

I tried entering device instance path *& also shared printer path on the same system, but it always says printer not found for that path.

So my issue is how to set correct printer path on "Printers" screen for USB-connected printer

@enoy19
Copy link
Owner

enoy19 commented Dec 8, 2023

Are you running zpl-tool inside a docker container or directly on your windows machine?

zpl-tool uses serialport (docs: https://serialport.io/) to communicate with serial devices. The Docs of Version 9.x.x of serialport show an example on windows. They are using "COM1", "COM2"... "COMX".
Do you have one of these ports available? And is it your printer? Or is USBPRINT\ZEBRA_TECHNOLOGIES_ZTC_ZD230-203DPI_ZPL\6&32827A83&0&USB001 your only path to the device?

Sadly I have no experience using serial communication on windows...

@enoy19
Copy link
Owner

enoy19 commented Dec 8, 2023

I just did some research @nirvitarka. Your printer might be mounted as a COM path.

  • Open your Device Manager
  • Expand the "Ports (COM & LPT)" section.
  • Look for your printer. it might be listed as a USB Serial Device or similar, with a COM port number.

@enoy19 enoy19 self-assigned this Dec 8, 2023
@nirvitarka
Copy link
Author

Ok so after debugging further, I found the error is from this part of code in fileUtil.ts

if (!path || !(await fileExists(path, false))) { throw new Error(${path} not found); }

This part is checking if there is filesystem access allowed to the "path" set for "serial" printer.

I believe this will work on linux because linux device path is a directory/file like /dev/ttyS0
However, this is not the case with Windows OS.
On windows the serial ports cannot be accessed as regular filesystem objects.

Hence this part of code is not applicable for windows.
Is this understanding correct?

I will try by commenting out this part of code to see what happens & if it is able to access the serial port properly.

@enoy19
Copy link
Owner

enoy19 commented Dec 8, 2023

Good explanation, thank you!
Yes this could be the cause.
If that's the cause of the error we might drop this check or deactivate it using a flag.

Was your test successful?

@nirvitarka
Copy link
Author

Commented this file check & the code execution went ahead without error for "Printer not found".

However the serialport instance creation still fails for any USB path on line
const port = new SerialPort(this.config.options);

I see over other forums that people face such issues to access USB port using this package serialport

So we might need to implement it with a different package to handle USB ports on windows.

Will have to dig this further to find root cause & possible fix, but I am not able to spend much time on this immediately, will get back to this later when time allows me to.

@enoy19
Copy link
Owner

enoy19 commented Dec 8, 2023

Okay thank you very much for your effort! 🌟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants