Reputation: 206
I am currently getting an error about not being able to connect to my device through Chrome. I have the below code and allow for usb and serial in my manifest file.
var onGetDevices = function(ports) {
for (var i=0; i<ports.length; i++) {
console.log(ports[i].path);
//connect to serial port
}
chrome.serial.connect("/dev/tty.usbmodem1421", {bitrate: 9600}, onConnect);
};
var onConnect = function(connectionInfo) {
// The serial port has been opened. Save its id to use later.
console.log(connectionInfo);
};
$( document ).ready(function() {
chrome.serial.getDevices(onGetDevices);
});
Upvotes: 1
Views: 481
Reputation: 206
I did not add the correct permissions to my manifest file. I needed to add...
"usbDevices": [ { "vendorId": "xxxx", "productId": 1234 } ] } ]
Upvotes: 1