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 thermal prints with same venderId and productId issue #38

Open
hoxer80 opened this issue Mar 23, 2021 · 2 comments
Open

USB thermal prints with same venderId and productId issue #38

hoxer80 opened this issue Mar 23, 2021 · 2 comments

Comments

@hoxer80
Copy link

hoxer80 commented Mar 23, 2021

I have 2 thermal prints connected via USB.
They are same model.

Then only first thermal print works.
Second print can not select with requestUsb() because they have same venderId and productId.

If I use different model, they work both.

Do you have any idea to solve when I have same models?

@bebo925
Copy link
Owner

bebo925 commented Mar 23, 2021

I bet Chrome is confused. If you remove the device from Chrome and re-add it, I bet they will both work individually. Do you have to use both at the same time?

@hoxer80
Copy link
Author

hoxer80 commented Mar 23, 2021

I bet Chrome is confused. If you remove the device from Chrome and re-add it, I bet they will both work individually. Do you have to use both at the same time?

Thank you for the quick answer!
I need to use both at the same time.

I have tried to remove both and re-add.
Unfortunately it does not work for me.

I have to add serialNumber to get work on ng-thermal-print.js at 1027.

class UsbDriver extends PrintDriver {
    constructor(vendorId, productId, serialNumber) {
        super();
        this.isConnected = new BehaviorSubject(false);
        this.vendorId = vendorId;
        this.productId = productId;
        this.serialNumber = serialNumber;

    }
    connect() {
        navigator.usb.getDevices().then(devices => {
            this.device = devices.find((device) => {
                return device.vendorId === this.vendorId && device.productId === this.productId && this.serialNumber == device.serialNumber;
            });
            return this.device.open();
        }) 
......

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