问题
I succefully connected to mydevice (ps 3 pad) via usb and easily can intercept data depending on which button i press. But pad also can vibrate and has leds and i'd like to operate them as well so here as the questions:
though google manuals are really poor i tried to establish connection to device on my own:
var message = new Uint8Array(58);
message[0] = 1;
console.log(message.buffer);
chrome.hid.send(connectionId, reportId, message.buffer, function() {
console.log('accomplished')
}
ConnectionId is value returned from chrome.hid.connect value; reportId is value returned by chrome.hid.receive function. Although console.log says 'accomplished' it also returns error:
Unchecked runtime.lastError while running hid.send: Transfer failed. at Object.callback (chrome-extension://bckchoeidaohhpkojennfgnpkhnhheol/script.js:62:14)
After messing with that error, to find how to perform good send of data i used app you can find on github It can perform data analyze from device and send it to device as well. Theoretically because I dont know how to send data/in what format. I get data from device in format of hex bits like this:
08 00 00 80 80 80 80 80 80 80 80
And that means that first bit has changed its state to 08 (hex). How to send data to the device in similiar format? - thats first question. How to do it via app from link if anybody used it before?
Third question is - how to find out what kind of data triggers ie starting vibration of pad. I have some windows programs that turn vibration on, so some kind of data is sent via usb. I tried to monitor the data with USBlyzer and similiar software but the ammount of continous data outgoing and incoming is so big that it is impossible (form me) to find any pattern. How to convert that data to appropriate string familiar for device?
I hope you guys have some experience with that and you can share it with me.
Kalreg
来源:https://stackoverflow.com/questions/34777715/how-to-send-data-to-usb-hid-via-chome-app-javascript