Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SerialPort 7.1.4 old version #15

Open
adalborgo opened this issue Jan 31, 2021 · 1 comment
Open

SerialPort 7.1.4 old version #15

adalborgo opened this issue Jan 31, 2021 · 1 comment

Comments

@adalborgo
Copy link

Hi,
I tried to compile Blocklino with Windows 10, but the version of SerialPort 7.1.4 is too old and I couldn't complete the installation. I therefore used the latest version 9.0.6 which however does not see the serial ports.

In the documentation of "https://serialport.io/docs/api-stream" I found these notes:

  • In serialport@8 and @serialport/bindings@3 we renamed PortInfo.comName to PortInfo.path. If you use comName you'll get a warning until the next major release.
  • In serialport@8 and @serialport/bindings@3 we removed the optional callback to list(). You now have to use the promise it returns and if you provide a callback you will get an error.

This is probably due to the use of port.comName in the index.js file.
Is it possible to modify the index.js file to make it compatible with the new version of SerialPort?
Thank you.

@fontainejp
Copy link
Owner

Hi,
Yes you can modify everything in index.js it's free !
all is here :
sp.list(function(err,ports){ var opt = document.createElement('option') opt.value = "com" opt.text = Blockly.Msg.com1 portserie.appendChild(opt) ports.forEach(function(port) { if (port.vendorId){ var opt = document.createElement('option') opt.value = port.comName opt.text = port.comName portserie.appendChild(opt) } }) localStorage.setItem("nb_com",ports.length) if (portserie.options.length > 1) { portserie.selectedIndex = 1 localStorage.setItem("com",portserie.options[1].value) } else { localStorage.setItem("com","com") } }) sp.list(function(err,ports){ var messageUSB = document.getElementById('usb') if (ports.length === 0) { messageUSB.innerHTML = "Aucun port n'est disponible" // port not available } else { tableHTML = tableify(ports) messageUSB.innerHTML = tableHTML } }) $('#portserie').mouseover(function(){ sp.list(function(err,ports) { var nb_com = localStorage.getItem("nb_com"), menu_opt = portserie.getElementsByTagName('option') if(ports.length > nb_com){ ports.forEach(function(port){ if (port.vendorId){ var opt = document.createElement('option') opt.value = port.comName opt.text = port.comName portserie.appendChild(opt) localStorage.setItem("com",port.comName) } }) localStorage.setItem("nb_com",ports.length) localStorage.setItem("com",portserie.options[1].value) } if(ports.length < nb_com){ while(menu_opt[1]) { portserie.removeChild(menu_opt[1]) } localStorage.setItem("com","com") localStorage.setItem("nb_com",ports.length) } }) })
But i think it's possible to install a specific version with :
npm install serialport@7.1.4`
Presently i have no time to update all modules, this summer will be probably the good time.
Bye

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants