-
Notifications
You must be signed in to change notification settings - Fork 397
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
macOS cannot open device with some specific paths #116
Comments
As far as I can see in the discussion, your device is a keyboard-like device, and as @todbot already mentioned, you will not be able to open it as a general HID device since macOS won't let you. If the device is your own development, I'd suggest adding another USB-HID interface to that device with a custom (vendor) HID protocol (or use one of the standard ones, but not a Keyboard), and use it for communication you need. Without the device itself there is not much we can help you with. |
Have you maybe tried running your application as root? |
Even if I run with the 'sudo' command, I can't turn on the device |
@Youw @z3ntu But you can get two usagePage and two usage on the same device under Windows, and can open device.
|
Don’t believe one of my patches has been merged yet. Can you try my fork and let me know if that works?
https://github.com/flirc/hidapi
Very Sincerely,
Jason
… On Nov 14, 2019, at 10:14 PM, 干志雄 ***@***.***> wrote:
@Youw @z3ntu
In macOS calls HID.Devices(), MacOS there's only one usagePage and one usage for the same device, macOS Device cannot be open.
But you can get two usagePage and two usage on the same device under Windows, and can open device.
This is the device information that you got under Windows
{
vendorId: 6790,
productId: 57568,
path: '\\\\?\\hid#vid_1a86&pid_e0e0&col02#7&83dd5c8&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}\\kbd',
serialNumber: '30A31F8ED8F3BFCE',
manufacturer: 'TJT-USB',
product: 'test-30A31F8ED8F3BFCE',
release: 0,
interface: -1,
usagePage: 1,
usage: 6
},
{
vendorId: 6790,
productId: 57568,
path: '\\\\?\\hid#vid_1a86&pid_e0e0&col01#7&83dd5c8&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}',
serialNumber: '30A31F8ED8F3BFCE',
manufacturer: 'TJT-USB',
product: 'test-30A31F8ED8F3BFCE',
release: 0,
interface: -1,
usagePage: 65280,
usage: 1
},
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@GanZhiXiong macOS merges all usage pages into a single device, if endpoints don't overlap over usage pages, so, as a workaround for now, you may just skip filtering usage page on macOS and open a device by VID/PID/SN only, on macOS. Once #65 is done - hidapi will report separate devices for different usage pages on macOS. Technically it will be same native device. |
@jdk Thanks. I use 'node - hid' https://github.com/node-hid/node-hid, I know 'node - hid' use 'hidapi', but I don't know how to use your fork in 'node - hid'. |
I’m in the process of updating node-hid to use this updated version. The new version of node-his should be out in a few days. Thanks for your patience! (and thanks to hidapi team for applying all these fixes) |
Also, @jdk, can you check libusb/hidapi versus your signal11/hidapi changes? It appears hidapi/mac/hid.c supports interface numbers now. |
Yes, will do this tomorrow. I need a series of hubs to help repro this. The original version had interface numbers as well, but the issue happened when we had two many parent hubs and reading our string failed. Will report back.
Very Sincerely,
Jason
… On Nov 18, 2019, at 12:53 PM, Tod E. Kurt ***@***.***> wrote:
Also, @jdk <https://github.com/jdk>, can you check libusb/hidapi versus your signal11/hidapi changes? It appears hidapi/mac/hid.c supports interface numbers now.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#116?email_source=notifications&email_token=AABKD5RFGNRKJJUJHH6UDLTQUL6F5A5CNFSM4JKR5KO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEL34YQ#issuecomment-555204194>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABKD5TEKKO243FJQ2TFD2DQUL6F5ANCNFSM4JKR5KOQ>.
|
@jdk I use macOS, can you tell me how to operate? What IDE should I use? Commands to execute? |
I can confirm that the latest libusb/hidapi code still doesn’t solve the issue. My patch is still needed. I’ll rebase and do a pull request.
… On Nov 14, 2019, at 10:14 PM, 干志雄 ***@***.***> wrote:
@Youw <https://github.com/Youw> @z3ntu <https://github.com/z3ntu>
In macOS calls HID.Devices(), MacOS there's only one usagePage and one usage for the same device, macOS Device cannot be open.
But you can get two usagePage and two usage on the same device under Windows, and can open device.
This is the device information that you got under Windows
{
vendorId: 6790,
productId: 57568,
path: '\\\\?\\hid#vid_1a86&pid_e0e0&col02#7&83dd5c8&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}\\kbd',
serialNumber: '30A31F8ED8F3BFCE',
manufacturer: 'TJT-USB',
product: 'test-30A31F8ED8F3BFCE',
release: 0,
interface: -1,
usagePage: 1,
usage: 6
},
{
vendorId: 6790,
productId: 57568,
path: '\\\\?\\hid#vid_1a86&pid_e0e0&col01#7&83dd5c8&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}',
serialNumber: '30A31F8ED8F3BFCE',
manufacturer: 'TJT-USB',
product: 'test-30A31F8ED8F3BFCE',
release: 0,
interface: -1,
usagePage: 65280,
usage: 1
},
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#116?email_source=notifications&email_token=AABKD5W23GKR7TTYY7LKEDLQTY43TA5CNFSM4JKR5KO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEENVZQ#issuecomment-554228454>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABKD5U4JLSSXYCEGIH7NH3QTY43TANCNFSM4JKR5KOQ>.
|
Wow, it appears I closed it 2 day ago, but I definitely didn't mean to. The patch is still welcome anyway. |
For clarification, #65 may solve another issue. The patch in my branch wasn't specifically for a usage table, but may be related if a device interface can not be found. The original issue for my patch was: signal11/hidapi#301 signal11/hidapi#301 is long standing and patches to address were: Issue signal11/hidapi#301 is still present on our current top of tree. I will rebase these patches this week and submit a pull request. |
it seems that a variation of flirc/hidapi@a4dd0f3 is already in master as for flirc/hidapi@8d251c3 - I think it is not related to #65 |
I've been tracking this issue for a while now, as I'm having the same issue. Trying to use hidapi to talk to Elgato Stream Deck
I lost a bit track of the status though. Is there any pending PR that may solve the issue? :) |
Not right now. |
Yeah, I guess the Stream Deck is keyboard like, as it has mainly keyUp and keyDown events. But I'd also assume you would be able to grant those (accessibility?) MacOS permissions to the program that's using the hidapi though, no? |
Not sure regarding accessibility, never tried. Not having access a keyboard input events is a general security concern, since if any app could just open a keyboard and read all input, it could simply steal your input the data, like your password/card pin etc. For key Up/Down events more reliable approach is to use native input event hooks, but those work only when your application is active/have a window. What exactly are you trying to achieve? Is this your device (you developing it) or do you want to use an existing device? |
I am using node-hid, so I tried adding
I want to handle keyUp and keyDown inside a custom NodeJS app instead of using the proprietary app that comes with the device. However, I gave up on HIDAPI yesterday and am now hooking into their plugin system and send all events from via WebSocket to my node app from there. It was a bit more pain to code, but since it's done now, I'll not pursue the original approach further. However, I'll be happy to test and debug if that helps! :) |
that is likely an easier solution to actually get it done |
Is there a way to capture a keyboard device with HIDAPI if I am fine with the restriction that the app be focused? I would prefer to stick with this library rather than native hooks since it is easily cross platform, and I'd prefer to use raw HID packets (My plan is to forward them to a second device and send them into a virtual HID device, so that it is "extended") If this deserves another issue due to the focus on the Stream deck, I can split mine out, but this came up in my searching. Thanks. |
It doesn't matter the state of the app, the OS "owns" keyboards and mice for security reasons. If you're trying to control the non-keyboard parts of a keyboard-like device, it's almost guaranteed the device exposes an alternate usage/usagePage, interface number, or entire interface. You should be able to see the first two If you're looking to write an interface to the Streamdeck, I recommend checking out the work done here and cribbing from it: https://github.com/Lange/node-elgato-stream-deck |
Thank you Tod. I am wanting the keyboard parts, so in that case I think my best bet is to reconstruct HID-like packets from the standard key reading techniques. |
Have you got a solution? Im facing the same problem using @ledgerhq/hw-transport-node-hid lib to connect with nano ledger device |
I see that node-hid/node-hid#348 has been closed. What about this #116? |
@GanZhiXiong Can you give latest git a try? |
@fedecaccia Have you tried plain hidapi? |
This should have been fixed as of #322. |
macOS cannot open device with path IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/XHC1@14/XHC1@14000000/HS03@14300000/USB2.0 Hub@14300000/AppleUSB20Hub@14300000/AppleUSB20HubPort@14310000/HELLOKEY-8F3A4DEAFF1A0D6A@14310000/IOUSBHostInterface@0/IOUSBHostHIDDevice@14310000,0
Using 'node-hid' can open the device on Windows and Linux, but it cannot be opened on macOS.
I've submitted in 'node - hid issue, and discussed this matter todbot, specific can look here: node-hid/node-hid#348
I tested it on my colleague's computer today, and found that macOS Mojave 10.14.6 could open the device, but macOS Mojave 10.14.5 could not open the device, I will try to upgrade the system when I have time
The text was updated successfully, but these errors were encountered: