So I'm trying to connect to openEEG upon running the claimInterface() function I get
NetworkError: Unable to claim interface
lsusb shows this problem is likely because some MSI driver is running on the same driver
Output of lsusb -v -s4
Bus 002 Device 004: ID 1770:ff00
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x1770
idProduct 0xff00
bcdDevice 1.10
iManufacturer 1 MSI EPF USB
iProduct 1 MSI EPF USB
iSerial 1 MSI EPF USB
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 2mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 33 US
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 57
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Device Status: 0xa630
(Bus Powered)
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0403 Future Technology Devices International, Ltd
idProduct 0x6001 FT232 USB-Serial (UART) IC
bcdDevice 6.00
iManufacturer 1 FTDI
iProduct 2 FT232R USB UART
iSerial 3 A105XV9J
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 90mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 2 FT232R USB UART
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)
I originally tried adding 255 as the classCode on navigator.usb.requestDevice because the documentation said I can do that, but they don't have the same IDs so that was pointless. Also upon reconnecting I can only get lsusb to output of the MSI driver even though Chrome picks it up and I got an access denied error.
which is strange because I changed the udev rules and used sudo chmod -R 777 * In dev/bus/usb
I then found in folder "001" a file that I previously had to manually change the permissions of thinking it was the MSI driver but this time the original file was deleted in place of one named "007" instead of "005" (probably because I tried plugging the device in twice)
So this must be a combination of MSI security features? and OpenEEG creating a new file every time it's loaded?
The only solution I can think of is to delete a file that I don't understand and change the permissions every time it's plugged in. both of which are very prohibitive for uses especially since I want my website to work across a broad range of devices and operating systems
PS: Using Linux Mint if that's relevant and here is my code(I don't think it's the problem) that is being run with on local node.js server
document.addEventListener('DOMContentLoaded', event => {
let button = document.getElementById('connect')
button.addEventListener('click', async() => {
var device
const VENDOR_ID = 0x0403
const PRODUCT_ID = 0x6001
const CLASS_CODE = 255
device = await navigator.usb.requestDevice({
filters: [{
vendorId: VENDOR_ID,
productId: PRODUCT_ID,
classCode: CLASS_CODE
}]
})
console.log('opening..')
await device.open()
console.log('open!')
.then(() => device.selectConfiguration(1))
.then(() => device.claimInterface(0)).catch(error => { console.log(error + 'eeeeeeerrrr ' + device.configuration.interfaces[0].interfaceNumber); });
console.log(device);
await device.close().catch(error => { console.log(error + 'eeeeeeerrrr'); });
});
})
EDIT/UPDATE: lsusb returns nothing when not connected the two drivers are coming from the same input???????
When you connect your device on the USB port Linux loads its driver and claim the device for itself.
If you want to use it somewhere else just unload the driver:
$ sudo modprobe -r ftdi_sio
If you reboot your computer the driver will load again and you'll have to unload it manually. If you want to keep it unloaded you can do:
$ echo "ftdi_sio" | sudo tee -a /etc/modules
I can understand why it got you confused, considering the output of lsusb is not that clear but I think the other MSI driver is for the root USB controller on your computer. If you remove it you won't be able to see your ports or anything connected to them.
If unloading the driver does not fix your problem maybe you're not claiming the correct device. You can find out more reading the log file if you write on your navigation bar chrome://device-log/
Related
I'm playing with a thermal printer to work with WebUSB.
Here is the minimal Glitch demo (please note this demo may show your connected usb devices):
preview: https://canary-adjoining-garlic.glitch.me
code: https://glitch.com/edit/#!/canary-adjoining-garlic
I'm able to select the (any) device. But unable to call device.open().
document.getElementById("print-button-usb").addEventListener("click", () => {
console.log('clicked');
navigator.usb.requestDevice({ filters: [] })
.then(device => {
console.log('device paired', device);
console.log(device.vendorId, typeof device.vendorId);
return device;
})
.then(device => device.open()) // Error here <<-------------------------------------!
.catch(err => console.error("my err", err));
})
Not only that printer, but I'm unable to open any connected shown devices. Can someone point out what am I missing here?
Environment details:
Ubuntu 22.04.1
Chrome Version 107.0.5304.121
I've been following this guide: https://web.dev/usb
Update : (Debug informations)
My chrome://device-log says: Failed to open /dev/bus/usb/001/005: Permission denied (13). I tried to cat that node:
$ cat /dev/bus/usb/001/005
#V �2 �##%
$ pwd
/dev/bus/usb/001
$ ls -l
total 0
crw-rw-r-- 1 root root 189, 0 Nov 30 23:13 001
crw-rw-r-- 1 root root 189, 1 Nov 30 23:13 002
crw-rw-r-- 1 root root 189, 2 Nov 30 23:13 003
crw-rw-r-- 1 root root 189, 3 Nov 30 23:13 004
crw-rw-r-- 1 root lp 189, 4 Dec 1 00:07 005
In the above image,
Integrated_Webcam_HD: laptop camera
KT USB Audio: my headphones connected via usb-c
CB-GK-16 Firefly: Additional keyboard
USB Portable Printer: the thermal printer I'm playing with
I tried to connect my phone over usb and tried to pair - I was able to pair it.
In this list, the "Pixel 3" device was the only device I was able to successfully connect. All others are returning the "Access Denied" error.
Same problem here using FTDI device.
I was able to get the device but not I could not open it with exactly the same error. I was using windows 10 by the way. Problem was solved by changing the driver from FTDI custom driver to WinUsb using zadig.
note:
after doing so, the device could not be used by the previous .NET application and it is only accessible by the browser.
I currently have two peers set to send audio through WebRTC (code is made to later support more users that dynamically change, so it's in a class, but otherwise should be normal), and although they DO connect, and DO send their track information, there is no received audio on either end. I run the getStats() as per documentation and got results that I don't understand:
ID: RTCInboundRTPAudioStream_3738623979
Timestamp: 1624090959263.524
ssrc: 3738623979
kind: audio
trackId: RTCMediaStreamTrack_receiver_1
transportId: RTCTransport_0_1
codecId: RTCCodec_0_Inbound_111
mediaType: audio
jitter: 0.001
packetsLost: 0
remoteId: RTCRemoteOutboundRTPAudioStream_3738623979
packetsReceived: 22142
fecPacketsReceived: 0
fecPacketsDiscarded: 0
bytesReceived: 1664520 <---
headerBytesReceived: 631982
lastPacketReceivedTimestamp: 1624090959262
jitterBufferDelay: 0
jitterBufferEmittedCount: 0
totalSamplesReceived: 0 <---
concealedSamples: 0
silentConcealedSamples: 0
concealmentEvents: 0
insertedSamplesForDeceleration: 0
removedSamplesForAcceleration: 0
audioLevel: 0 <---
totalAudioEnergy: 0
totalSamplesDuration: 0
There is no audio (audioLevel: 0), no received samples (totalSamplesReceived: 0), but there are bytes being received (at about 29kbps so I believe less than should be used by that codec which is:
ID: RTCCodec_0_Inbound_111
Timestamp: 1624092364725.83
transportId: RTCTransport_0_1
payloadType: 111
mimeType: audio/opus
clockRate: 48000
channels: 2
sdpFmtpLine: minptime=10;useinbandfec=1
which according to a google search should be ~52kbps)
Receiver and sender tracks are both not 'muted' and they are 'enabled'.
Wireshark detects seemingly random bits being sent between the ports (the whole thing runs now on localhost in two browsers) at expected rate (~110 bits per packet) so PROBABLY the audio is sent just not correctly received.
My code closely matches the one used here https://webrtc.org/getting-started/remote-streams (except, of course, for it being in a class).
I tried both setting the stream in addTrack like this: peerConnection.addTrack(track, localStream) and omitting it (peerConnection.addTrack(track)).
Same results in Brave (chromium) and Firefox.
I need to retrieve the real architecture of a Mac regardless of if the process is running through Rosetta or not.
Right now in Node.js, process.arch returns x64 and in shell, uname -m returns x86_64.
Thanks to #Ouroborus, this note describes how to figure out if your app is translated.
If it's translated:
$ sysctl sysctl.proc_translated
sysctl.proc_translated: 1
If not:
$ sysctl sysctl.proc_translated
sysctl.proc_translated: 0
On non-ARM Macs:
$ sysctl sysctl.proc_translated
sysctl: unknown oid 'sysctl.proc_translated'
As #Elmo's answer indicates, the command line sysctl -n sysctl.proc_translated or the native equivalent sysctlbyname() call will indicate whether you are running under Rosetta.
Two other sysctl values are relevant. On M1 hardware without Rosetta, these values are returned:
hw.cputype: 16777228
hw.cpufamily: 458787763
hw.cputype is 0x0100000C (CPU_TYPE_ARM64) and hw.cpufamily is 0x1b588bb3 (CPUFAMILY_ARM_FIRESTORM_ICESTORM).
However, when executed under Rosetta, the low-level machine code which collects CPUID takes precendence and following two values are returned, both via sysctlbyname() and the command line:
hw.cputype: 7
hw.cpufamily: 1463508716
These correspond to 0x7 (CPU_TYPE_X86) and 0x573b5eec (INTEL_WESTMERE).
It appears Rosetta reports an x86-compatible Westmere chip under Rosetta, but this choice seems consistent everywhere I've seen. This "virtual architecture" may be useful information for some programs.
Another possibility presents itself in the IO Registry. While the default IOService plane collects data in real-time, the IODeviceTree plane is stored at boot, and includes these entries in the tree (command line ioreg -p IODeviceTree or ioreg -c IOPlatformDevice):
cpu0#0 <class IOPlatformDevice, id 0x10000010f, registered, matched, active, busy 0 (180 ms), retain 8>
| | | {
...
| | | "compatible" = <"apple,icestorm","ARM,v8">
(for CPUs 0-3)
and
cpu4#100 <class IOPlatformDevice, id 0x100000113, registered, matched, active, busy 0 (186 ms), retain 8>
| | | {
...
| | | "compatible" = <"apple,firestorm","ARM,v8">
(for CPUs 4-7)
This clearly indicates the ARMv8 Firestorm + Icestorm M1 chip.
The same approach should work for the M1 Pro and M1 Max.
I am developing a React Native (0.45.0) application and once in a couple of hours my application crashes (or rather gets killed by watchdog) with 0x8badf00d. I understand why watchdog kills the application; the main thread takes longer than 20 seconds to respond to an event. But I have no idea how to debug this in React Native. Everything is in Javascript and in promises so I am assuming that the network execution that I am doing is already asynchronous.
The application seems to be only crashing while it's in the background. However, the crash reports role states Foreground. We are using background fetch and background geolocation which both do a network request. I have measured the time from event trigger to finish and it does not take longer than one second in total.
I read that the most common problem for this error to happen is a network request on the main threat. Could it be that it tries to load the js bundle synchronously and hangs? How can I debug this problem when all my code is in Javascript?
Thank you very much in advance.
Incident Identifier: 36E63A5F-7C40-40C0-9914-2C9EAE494C11
Beta Identifier: 3C432B54-1947-470E-A387-6566A494E145
Hardware Model: iPhone7,2
Process: [993]
Path: /private/var/containers/Bundle/Application/70B3363C-32E9-4D26-B6C6-DB51304D46C7/.app/
Identifier: org.reactjs.native.example.Test3
Version: 20 (1.4)
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: org.reactjs.native.example.Test3 [703]
Date/Time: 2017-07-17 21:31:33.1931 -0400
Launch Time: 2017-07-17 19:18:30.9574 -0400
OS Version: iPhone OS 10.3.2 (14F89)
Report Version: 104
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace <0xF>, Code 0x8badf00d
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib
0x0000000182a07224 0x182a06000 + 4644
1 libsystem_kernel.dylib
0x0000000182a0709c 0x182a06000 + 4252
2 CoreFoundation
0x00000001839d8e90 0x1838fe000 + 896656
3 CoreFoundation
0x00000001839d6ae4 0x1838fe000 + 887524
4 CoreFoundation
0x0000000183906da4 0x1838fe000 + 36260
5 GraphicsServices
0x0000000185370074 0x185364000 + 49268
6 UIKit
0x0000000189bc1058 0x189b4c000 + 479320
7
0x00000001000bfa08 0x1000b8000 + 31240
8 libdyld.dylib
0x000000018291559c 0x182911000 + 17820
Update, symbolized part of the crash log:
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000182faf224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000182faf09c mach_msg + 72
2 CoreFoundation 0x0000000183f80e90 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x0000000183f7eae4 __CFRunLoopRun + 1060
4 CoreFoundation 0x0000000183eaeda4 CFRunLoopRunSpecific + 424
5 GraphicsServices 0x0000000185918074 GSEventRunModal + 100
6 UIKit 0x000000018a169058 UIApplicationMain + 208
7 0x0000000100063294 0x10005c000 + 29332
8 libdyld.dylib 0x0000000182ebd59c start + 4
My question is, what is the most efficient configuration for PhantomJS tests.
Currently I have 1 instance of PhantomJS running and every instance can have 2 tabs opened (dev env).
Is it better to have more instance of phantomjs or opened tabs, and if tabs, what is the upper limit of PhantomJS.
CPU:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core(TM) i5-3210M CPU # 2.50GHz
stepping : 9
microcode : 0x19
cpu MHz : 2494.316
cache size : 3072 KB
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc up rep_good nopl xtopology nonstop_tsc pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx rdrand hypervisor lahf_lm
bogomips : 4988.63
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
Memory:
total used free shared buffers cached
Mem: 2515896 1155828 1360068 0 171648 622668
More information:
I would like to handle multiple tests at once with as less memory as possible. Now I am running two pages per phantom instance, and already I am having issues with network requests. I have a timeout of 20s and if a specific network request is not finished in that time, test fails.
Test is successful if I only run one page in one PhantomJS instance, but that is not optimal, because we will be running more then 1000 tests, and I would like to arrange tests in multiple pages across multiple phantomjs instances.
Example:
10 phantomjs instances
every phantomjs instance can run 30 pages
Now why when running multiple pages in one instance, does the network request lag so much?