coderlyfe
coderlyfe

Reputation: 206

Can't connect to USB to Serial Device For Chrome Extension App

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

Answers (1)

coderlyfe
coderlyfe

Reputation: 206

I did not add the correct permissions to my manifest file. I needed to add...

"usbDevices": [ { "vendorId": "xxxx", "productId": 1234 } ] } ]

Upvotes: 1

Related Questions