-
Notifications
You must be signed in to change notification settings - Fork 287
HID constructor
This is the main constructor which runs the API hid_init() and hid_open_path methods
It will return a device handle (i.e. pointer) that will be used to work with the device derectly.
Depending on how many arguments are passed into HID(), different API methods will be invoked
var d = new HID(arg1[,arg2])
To open the device by its path, only one argument is passed (i.e. arg1) and hid_open_path() will be invoked and the OS specific path to the device must be provided as the argument.
Otherwise, you have to provide 2 arguments (i.e. arg1 and arg2) where:
- arg1 - vendor id of the device
- arg2 - product id of the device
And hid_open() will be invoked to get a handle on the device.
If a device cannot be opened, an exception will be raised.
*** Note: some devices will open with an exclusive lock on the device. This means another process cannot also request to open that same device.