joshmarinacci / ElectronIDE

New web based Arduino IDE
BSD 3-Clause "New" or "Revised" License
246 stars 50 forks source link

Detect board model on serial port #34

Closed PixnBits closed 10 years ago

PixnBits commented 10 years ago

auto-detect which Arduino board is on the port

PixnBits commented 10 years ago

the serialport module used allows for listing of ports

var serialPort = require("serialport");
serialPort.list(function (err, ports) {
  ports.forEach(function(port) {
    console.log('port:', port);
  });
});

currently on my Win8 box data is in the form:

{ comName: 'COM13',
  manufacturer: 'PJRC.COM, LLC.',
  serialNumber: '',
  pnpId: 'USB\\VID_2341&PID_0043\\95238343334351014212',
  locationId: '',
  vendorId: '',
  productId: '' }

I'm thinking contributing to that module to properly populate the data fields (parse out VID and PID). I don't have a Mac, is the data the same on that platform?

PixnBits commented 10 years ago

Hmm. The node-serialport module is in C not JS, so I'll need to brush up on my C string parsing. For now, JS in electron...

joshmarinacci commented 10 years ago

Yes, the format on Mac is the same, though it does have a bit more information. A Leonardo on my Mac shows:

{ comName: '/dev/cu.usbmodemfd14121', manufacturer: 'Arduino LLC', serialNumber: '', pnpId: '', locationId: '0xfd141200', vendorId: '0x2341', productId: '0x8036' }

PixnBits commented 10 years ago

Awesome! Just to confirm, the auto-select works with your Leonardo?

joshmarinacci commented 10 years ago

Yep. Worked beautifully. Thank you!