Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
Electron Device Access "serial-port-added" / 'serial-port-removed' not firing

I'm running Electron ^18.0.1. I'm trying to get the events to "serial-port-added" / "serial-port-removed". From what I understand from the documentation the events should fire off when devices are connected/disconnect while the "select-serial-port" event has been fired but before the device selection callback has been returned.

My question: I haven't been able to figure out how to get the events to fire off. I'm not sure If have missunderstood the documentation/doing somthing wrong or if it's a bug?

 mainWindow.webContents.session.on('select-serial-port', (event, portList, webContents, callback) => {
    event.preventDefault()
    if (portList && portList.length > 0) {

      // Tried many, many things before running the callback.

      callback(portList[0].portId)
    } else {
      callback('') //Could not find any matching devices
    }
  })

  mainWindow.webContents.session.on('serial-port-added', (event, port) => { // <-- Event not firing?
    console.log('serial-port-added FIRED WITH', port)
  })

  mainWindow.webContents.session.on('serial-port-removed', (event, port) => { // <-- Event not firing?
    console.log('serial-port-removed FIRED WITH', port)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!