opening an hiddevice failes - hid

I have a device to program which uses hidapi. I had problems in opening a device when running my program in eclipse. My first guess was that it is a permission problem.
So I added the following udev rule in a text file, with vendor and product id of my device:
SUBSYSTEM=="usb", ATTRS{idVendor}=="06cb", ATTRS{idProduct}=="009a", MODE="0666"
in the /etc/udev/rules.d
I rebooted the system and plugged in the device again.
Now when I try
sudo udevadm test /dev/usb/hiddev3
(which is the path to my device), I can see in the list that it reads the rule I added. But still I get this message at the end:
unable to open device '/sys/dev/usb/hiddev3'
So my question is:
Is it really a permission issue that hinders access to the device? If not, what are other problems that can block opening a hid device?
If it is a permission issue, how can I solve it? Is there any other udev rule to add?
I am on ubuntu 18.04.
Thank you very much

Related

Back button not working on android emulator

I try to start an android sdk emulator, but when I press the back button this error appears:
INFO | Critical: Failed to load https://maps.googleapis.com/maps/api/mapsjs/gen_204?csp_test=true: The 'Access-Control-Allow-Origin' header has a value 'qrc://' that is not equal to the supplied origin. Origin 'qrc://' is therefore not allowed access. (qrc:/html/js/common.js:0, (null))
INFO | Critical: Failed to load https://maps.googleapis.com/maps/api/mapsjs/gen_204?csp_test=true: The 'Access-Control-Allow-Origin' header has a value 'qrc://' that is not equal to the supplied origin. Origin 'qrc://' is therefore not allowed access. (qrc:/html/js/common.js:0, (null))
I use Ubuntu and try to start the emulator through terminal, I use the avdmanager of the google cmdline-tools (latest version) and this is the AVD that I try to use:
Name: my_avd_29ii
Path: /home/user/.android/avd/my_avd_29ii.avd
Target: Google APIs (Google Inc.)
Based on: Android 10.0 (Q) Tag/ABI: google_apis/x86
Sdcard: 512 MB
The best option would (Needs to be done for every emulator you install)
Windows
%USERPROFILE%\.adnroid\avd\<Emulator Name>.avd
Edit config.ini
Change hw.keyboard=no to hw.keyboard=yes
Mac
~/.adnroid/avd/<Emulator Name>.avd
Edit config.ini
Change hw.keyboard=no to hw.keyboard=yes
The answer is based on this article
After looking around I found that there were two ways to push hardware events to the emulator:
First method
This method uses telnet, like so:
telnet 127.0.0.1 5554
auth <auth-key>
event send EV_KEY:KEY_BACK:0
event send EV_KEY:KEY_BACK:1
This is going to simulate the pressing down (0) the releasing (1) of a button.
Second method
This method uses adb, like so:
adb shell input keyevent KEYCODE_BACK
Ok so what?
After trying both, I realized that telnet didn't work but adb did work. I also checked the source code of emulator and saw that telnet relies on the same set of functions that are used by the tool-window. So it's probably a bug, and we can wait for the update to fix it, or...
In the meantime
I downloaded the source code, wrote a janky workaround, and built it. Basically instead of using the keypress method, I use the adb method. If you want here it is. It's quite voluminous so be patient. I included a small script to automatically replace the emulator, just run:
$ chmod +x replace
# ./reaplace path-to-android-sdk
This adds a new flag -use-adb-toolwindow to emulator. When you activate it it will use adb (successfully) for most of keyboard inputs, and home, back, apps and power buttons. Like I said it's a quick fix, but for me it works fine.
Note:
I have no clue where the bug is, so I didn't do any report, hopefuly as more people get this issue it will become clearer.

Open() syscall on linux freezes terminal

Im trying to make a connection to a rs232 serial card PCIe-1622. I've compiled the drivers and installed the kernel modules (adv_17v35x). And in /dev it shows the relevant tty devices.
However, when I go to test them by echoing data to them or with cat. It freezes, and I get left with a cursor on the next line with no output. I can Ctrl-c to exit.
After some looking around online, I've made a simple program that opens the dev file, using open("/dev/ttyB15P0", O_RDWR); but the program gets stuck on that line, same symptoms as with echo/cat. I've placed an fprintf(stderr,"test"); before and after it, so I know it is that line/function that's holding up the program.
Does anyone have any info or insight as to what might be causing this issue, why is the device file failing to open, or even return a null file descriptor or error?
Thanks in advance.

error during e2e tests: USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection [duplicate]

We recently upgraded our Windows 10 test environment with ChromeDriver v87.0.4280.20 and Chrome v87.0.4280.66 (Official Build) (64-bit) and after the up-gradation even the minimal program is producing this ERROR log:
[9848:10684:1201/013233.169:ERROR:device_event_log_impl.cc(211)] [01:32:33.170] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Minimum Code Block:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
driver.get('https://www.google.com/')
Console Output:
DevTools listening on ws://127.0.0.1:64170/devtools/browser/2fb4bb93-79ab-4131-9e4a-3b65c08dbffb
[9848:10684:1201/013233.169:ERROR:device_event_log_impl.cc(211)] [01:32:33.170] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[9848:10684:1201/013233.172:ERROR:device_event_log_impl.cc(211)] [01:32:33.173] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Anyone facing the same? Was there any change in ChromeDriver/Chrome v87 with respect to ChromeDriver/Chrome v86?
Any clues will be helpful.
However these log messages can be supressed from appearing on the console through an easy hack i.e. by adding an argument through add_experimental_option() as follows:
options.add_experimental_option('excludeSwitches', ['enable-logging'])
Code Block:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
# to supress the error messages/logs
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
driver.get('https://www.google.com/')
My apologies for the log spam. If you aren't having issues connecting to a device with WebUSB you can ignore these warnings. They are triggered by Chrome attempting to read properties of USB devices that are currently suspended.
After going through quite a few discussions, documentations and Chromium issues here are the details related to the surfacing of the log message:
[9848:10684:1201/013233.169:ERROR:device_event_log_impl.cc(211)] [01:32:33.170] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Details
It all started with the reporting of chromium issue Remove WebUSB's dependency on libusb on Windows as:
For Linux (probably Mac as well), both WebUSB notification and communication works correctly (after allowing user access to the device in udev rules).
For Windows, it seems that libusb only works with a non-standard WinUsb driver (https://github.com/libusb/libusb/issues/255).
When the hardware is inserted and the VID/PID is unknown to the system, windows 10 correctly loads it's CDC driver for the CDC part and the WinUSB driver (version 10) for the WebUSB part (no red flags). However, it seems that chrome never finds the device until I manually force an older WinUSB driver (version 6 - probably modified also) on the interface.
The solution was implemented in a step-wise manner as follows:
Start supporting some transfers in the new Windows USB backend
Fix bulk/interrupt transfers in the new Windows USB backend
[usb] Read BOS descriptors from the hub driver on Windows
[usb] Collect all composite devices paths during enumeration on Windows
[usb] Remove out parameters in UsbServiceWin helper functions
[usb] Support composite devices in the new Windows backend
[usb] Detect USB functions as Windows enumerates them
[usb] Support composite devices with multiple functions
[usb] Hold interface requests until Windows enumerates functions
[usb] Add direction parameter to ClearHalt
[usb] Count references to a WINUSB_INTERFACE_HANDLE
[usb] Implement blocking operations in the Windows backend
These changes ensured that the new backend was ready to be tested and was available through Chrome Canary and chrome-dev-channel which you can access manually through:
chrome://flags#enable-new-usb-backend
More change requests were submitted as follows:
[usb] Mark calls to SetupDiGetDeviceProperty as potentially blocking: According to hang reports this function performs an RPC call which may take some time to complete. Mark calls with a base::ScopedBlockingCall so that the thread pool knows this task may be busy for a while.
variations: Enable NewUsbBackend in field trial testing config: This flag was experimental as beta-channel uses this change configuration as the default for testing.
As the experimental launch of the new backend appeared to be stable, finally these configuration was enabled by default so that the chanege rolls out to all users of Chrome 87 through usb: Enable new Windows USB backend by default. Revision / Commit
The idea was once this configuration becomes the default for a few milestones, Chromium Team will start removing the Windows-specific code from the old back-end and remove the flag.
Road Ahead
Chromium Team have already merged the revision/commit to Extend new-usb-backend flag expiration within Chrome v90 which will be available soon.
Update
As per #ReillyGrant's [Committer, WebDriver for Google Chrome] comment :
..." it would be good to reduce the log level for these messages so they don't appear on the console by default but we haven't landed code to do that yet"...
References
You can find a couple of relevant detailed discussions in:
Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Selenium on Windows OS
Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Chrome through Selenium
I encounered this problem yesterday,and I has fixed it by update all available windows update.
https://support.microsoft.com/en-us/windows/what-to-try-if-your-touchscreen-doesn-t-work-f159b366-b3ef-99ad-24a4-31a4c62ab46d
A partial solution that worked for me
I was getting this error too. It was stopping my program running.
I unplugged all my USB devices, ran the program, with no error.
Plugged the devices back in, ran the program. I am still getting the error, however, the program finished without the error stopping the program.
Note: For WebdriverIO on Windows 10, this suppresses the error messages for me:
"goog:chromeOptions": { "excludeSwitches": ["enable-logging"] }

I can't load kext on macOS Sierra

I'm trying load kext on macOS Sierra. but error occur.
Please, someone help me.
1.
csrutil disable && reboot
disable SIP.
2.
nvram boot-"debug=0x146 kext-dev-mode=1" && reboot
kext developer mode.
3.
kext build with xcode.
4.
cp -rf /Users//Library/Developer/Xcode/DerivedData//Build/Products/Debug /System/Library/Extensions
5.
kextload /System/Library/Extensions/test.kext
/System/Library/Extensions/test.kext failed to load - (libkern/kext) validation failure (plist/executable); check the system/kernel logs for errors or try kextutil(8).
6.
kextutil /System/Library/Extensions/test.kext
...
Code Signing Failure: code signature is invalid
If you are starting out with kext dev, don't put your kext in the Library/Extensions folder since this may cause a disaster if something goes wrong in your kext and prevent your OS from booting. You can load it from anywhere other than Library/Extensions.
The kext should load unless there's an obvious mistake of having csrutils being enabled. Just like someone from the comments said, check whether you have SIP turned on by using csrutil status. If not, I'm guessing you have a faulty plist in your project. Please post your plist so that I can take a look.
Referring to your 2. Starting from sierra nvram will not work unless you're in recovery mode.
If you have your csrutil disabled, you'll see
kext signature failure override allowing invalid signature -67050 0xFFFFFFFFFFFEFA16 for kext
after your Code signing failure prompt and then load your kext successfully.
Regarding step #2, according to Apple,
As of macOS El Capitan, the kext-dev-mode boot-arg is now obsolete.
$ sudo nvram boot-args="kext-dev-mode=1" # Has No Effect
You can simply add Oracle editor in this authorization list.
Restart your mac in Recovery mode (cmd + R)
Then open a Terminal and enter :
spctl kext-consent add VB5E2TV963
Restart your mac.
Ok for me with Mojave and Virtual Box 6.

Realm browser is not opening because of another process

I am getting this error message when I want to start up the Realm browser:
'Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. For sharing files between the Realm Browser and an iOS simulator, this means that you must use a 64-bit simulator.'
I closed all applications and even re-started the computer, so which process is this that is running there? It's been working all fine before.
You can check which process is using a file. On MacOS and Linux you can do it this way (replace myfilename with your actual database name):
lsof | grep myfilename.realm
You can kill the process using the file if needed.
If no process is running and the error still appears, you can safely delete the myfilename.realm.lock file.
I was able to open the file after stopping the app running on simulator/device.