HID Detecting Device - hid

I have a code which helps me in detecting all the USB devices connected into my PC. But I want to detect only the HID devices connected to my PC.
The code which I have written is
WqlEventQuery insertQuery = new WqlEventQuery("SELECT * FROM __InstanceCreationEvent WITHIN 2 WHERE TargetInstance ISA 'Win32_USBControllerdevice'");
ManagementEventWatcher insertWatcher = new ManagementEventWatcher(insertQuery);
insertWatcher.EventArrived += new EventArrivedEventHandler(DeviceInsertedEvent);
insertWatcher.Start();
Is there any query where we can fetch only the HID(Human Interface Device) connected devices.

Related

Add 2 I2c devices with the same adress in dts

I have a 2 different board each with a I2c device, the devices have the same address. I want to build one firmware where I can control both of devices depends on which device is connected to the I2C bus
device1#30 {
compatible = "device1";
reg = <0x30>;
clock-mode = /bits/ 8 <1>;
....
device2#30 {
compatible = "device2";
reg = <0x30>;
clock-mode = /bits/ 8 <1>;
I got an error when trying to read from the register of the second device which says that device 2 that be binded. How can I resolve this problem ?
NB : I have only 1 I2C Bus
I tried to add some detection function in the first and second device ( read ID register ) but it fails because I can't read the reg of the second device.

libusb on OSX returns less devices

I have a small xcode project that is mixed with c and Swift. The C side calling libusb_get_device_list returns less number of USB devices than it should. Only few times it returns the correct count. I checked the sandbox USB option ON. Also, disabled the signing. Still see it doing the same thing.
libusb_context *context = NULL;
libusb_device **list = NULL;
count = libusb_get_device_list(context, &list);

SUPSTRONICS X400 Raspberry pi 3 with Android things

I've been trying to create a car head using the raspberry pi and android things. In order to power the car audio I bought this amp Suptronics X400 but I haven't been able to use it as the default output for audio and I'm trying to integrate the Spotify SDK. I tried to create the drive but most of the Documentation here has been removed from the libraries. I'm a bit lost
The audio driver user driver is no longer available in Android Things. The right way is to use the AudioTrack class and set the preferred device type, as is done in this sample project.
You may need to specify the audio bus you want to send sounds to:
private AudioDeviceInfo findAudioDevice(int deviceFlag, int deviceType) {
AudioManager manager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
AudioDeviceInfo[] adis = manager.getDevices(deviceFlag);
for (AudioDeviceInfo adi : adis) {
if (adi.getType() == deviceType) {
return adi;
}
}
return null;
}
Then find the I2S bus:
mAudioInputDevice = findAudioDevice(AudioManager.GET_DEVICES_INPUTS, AudioDeviceInfo.TYPE_BUS);
mAudioOutputDevice = findAudioDevice(AudioManager.GET_DEVICES_OUTPUTS, AudioDeviceInfo.TYPE_BUS);
Then you can run audioTrack.setPreferredDevice(mAudioOutputDevice);

Microphone Device ID

I have three USB microphones plugged up to my Macbook Air via a USB hub. In the Audio MIDI I aggregated the devices and selected the aggregate device as the input for the computer. However, 'audiorecorder' is not picking up the device ID.
audiodevinfo
ans
{1x1 struct}
{1x1 struct}
and it's naming the internal microphone. Is there a way to set a device ID for each individual microphone?
You can determine if you have the correct name for a device using
mic1 = audiodevinfo(1, 0)
mic2 = audiodevinfo(1, 1)
mic3 = audiodevinfo(1, 2)
where the first argument is output/input (0 or 1) and the second argument is the device ID. Then you can address the mics separately, for example by using
audiorecorder(Fs, NBITS, NCHANS, ID)
and replacing ID with 1 for mic2
If you plug any mic in or out of the computer you may need to restart matlab for it to be recognized.

How to calculate Voice and Data usage in BlackBerry 10 application

Hi I am developing an application in BlackBerry 10 platform which will calculate data usage and voice usage of user device for particular duration.
There are some of the feasibility check need to be done for this which are as follows
Does BB10 API supports data usage calculation? If yes, Can I differentiate 3G/Cellular data from WiFi data?If yes, how can I achieve this?
How can I calculate Voice usage in BB 10 application? Voice usage is nothing but duration of all calls happened within particular timespan
Is there any API BB10 provides through which I can check if device is currently in Roaming or not?
Please let me know if this can be done in BB 10 application
Does BB10 API supports data usage calculation?
Yes, there are a few for API's for this
Can I differentiate 3G/Cellular data from WiFi data?
Yurp you can.
1) Add the following line to your .pro file:
LIBS += -lbbdevice
2) Make sure you include:
#include <bb/device/NetworkDataUsage>
3) Getting data useage for cellular network only
bb::device::NetworkDataUsage *nduCell = new bb::device::NetworkDataUsage("cellular0");
nduCell ->update();
quint64 bytesSent = nduCell ->bytesSent();
quint64 bytesReceived = nduCell ->bytesReceived();
4) Getting data useage for wifi only
bb::device::NetworkDataUsage *nduWifi = new bb::device::NetworkDataUsage("tiw_sta0");
nduWifi ->update();
quint64 bytesSent = nduWifi ->bytesSent();
quint64 bytesReceived = nduWifi ->bytesReceived();
That will give your the data useage since the device has started.
You will need to call ndu->update() regularly to get the most recent data usage statistics.
Extra Info:
Changing the parameter for the NetworkDataUsage changes the interface it minitors:
cellular0 == Cellular
tiw_sta0 == Wifi
ecm0 == USB
To find out which interfaces are available on your device:
1) Add the following line to your .pro file:
QT += network
2) Make sure you include:
#include <QNetworkInterface>
3) Displaying available interfaces
QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces();
for (int i = 0; i < interfaces.size(); i++) {
qDebug() << QString::number(i) + ": " + interfaces.value(i).humanReadableName();
}
How can I calculate Voice usage in BB 10 application? Voice usage is nothing but duration of all calls happened within particular timespan
This can be done using Phone class.
There is signal call void callUpdated (const bb::system::phone::Call &call, ) using which we can get to know if incoming call is received or outgoing call is initiated.
With the combination of this and Timer class we can calculate Voice usage of device. (This code is not tested)