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

Crashes on Windows 7 64-bit (requestDevice) #68

Closed
brandonros opened this issue Jun 18, 2020 · 12 comments
Closed

Crashes on Windows 7 64-bit (requestDevice) #68

brandonros opened this issue Jun 18, 2020 · 12 comments

Comments

@brandonros
Copy link

async getUsbDevice() {
    console.log('here')
    const device = await usb.requestDevice({
      filters: [
        {
          vendorId: VENDOR_ID,
          productId: PRODUCT_ID
        }
      ]
    })
    console.log('there')

there never gets printed

here
npm ERR! code ELIFECYCLE
npm ERR! errno 3221225477

node v12.18.1

windows 7 64-bit

webusb@2.0.2

@brandonros brandonros changed the title Crashes on Windows Crashes on Windows 7 64-bit (requestDevice) Jun 18, 2020
@brandonros
Copy link
Author

C:\Users\Brandon\Documents\GitHub\bash-uds-flasher\can-utils-js>npm install

> usb@1.6.3 install C:\Users\Brandon\Documents\GitHub\bash-uds-flasher\can-utils
-js\node_modules\usb
> prebuild-install --verbose || node-gyp rebuild

prebuild-install info begin Prebuild-install version 5.3.3
prebuild-install info looking for cached prebuild @ C:\Users\Brandon\AppData\Roa
ming\npm-cache\_prebuilds\579ac7-usb-v1.6.3-node-v72-win32-ia32.tar.gz
prebuild-install info found cached prebuild
prebuild-install info unpacking @ C:\Users\Brandon\AppData\Roaming\npm-cache\_pr
ebuilds\579ac7-usb-v1.6.3-node-v72-win32-ia32.tar.gz
prebuild-install info unpack resolved to C:\Users\Brandon\Documents\GitHub\bash-
uds-flasher\can-utils-js\node_modules\usb\build\Release\usb_bindings.node
prebuild-install info unpack required C:\Users\Brandon\Documents\GitHub\bash-uds
-flasher\can-utils-js\node_modules\usb\build\Release\usb_bindings.node successfu
lly

1
npm[7280]: c:\ws\src\node_buffer.cc:370: Assertion `(data) != nullptr' failed.
npm ERR! code ELIFECYCLE
npm ERR! errno 134

@thegecko
Copy link
Owner

Have you tried Node 10?

@brandonros
Copy link
Author

Yes. The way you listUSBDevices is kind of bad.

try {
                e.configDescriptor, e.allConfigDescriptors, e.deviceDescriptor
            } catch (e) {
                return Promise.resolve(null)
            }

this code crashes all node.js versions on all windows version with a C++ segfault

commenting out e.allConfigDescriptors yields some succes

then when you open all devices in getCapabilities, that causes another segfault

i'm gonna have to fork this awesome library you did for my needs to just open USB devices matching filters

@brandonros
Copy link
Author

can you pass options.filters all the way into

adapter

private loadDevices(filters): Promise<Array<Device>> {
        // Reset device cache
        this.devices = {};
        const devices = getDeviceList().filter(device => {
            
        })
        return this.serialPromises(this.loadDevice, devices);
    }

that will yield much better results for people on windows

@thegecko
Copy link
Owner

can you pass options.filters all the way into... loadDevices

I like that idea, see #70

@gniezen
Copy link

gniezen commented Jul 29, 2020

So glad I came across this thread. I could not figure out why my code was working on MacOS and Linux, and then everything just crashes on Windows (7 and 10). For a couple of days I thought it was USB driver-related, so I've been trying WinUSB, libusbK etc.

Any idea when these changes will be out of preview @thegecko ?

@thegecko
Copy link
Owner

Any idea when these changes will be out of preview

Once I hear they have fixed the issue :) The preview is on npm here:

https://www.npmjs.com/package/webusb/v/2.0.3-next.0a3f331.0

@gniezen
Copy link

gniezen commented Jul 29, 2020

Well, they fixed they fixed the issue for me 👍 How about you @brandonros ?

@brandonros
Copy link
Author

all good

@gniezen
Copy link

gniezen commented Aug 13, 2020

@thegecko Are you still waiting on something else to confirm that this is now fixed before the next release?

@thegecko
Copy link
Owner

Are you still waiting on something else...

My holiday to finish. I'm back now and have released v2.1.0

@gniezen
Copy link

gniezen commented Aug 17, 2020

Thanks @thegecko , hope you had a good holiday!

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

3 participants