Git Product home page Git Product logo

cp2102's People

Contributors

dependabot[bot] avatar gniezen avatar simonarnell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cp2102's Issues

missing libudev.h

npm ERR! code 1
npm ERR! path /root/homebridge/node_modules/usb
npm ERR! command failed
npm ERR! command sh -c node-gyp-build
npm ERR! make: Entering directory '/root/homebridge/node_modules/usb/build'
npm ERR!   CC(target) Release/obj.target/libusb/libusb/libusb/core.o
npm ERR!   CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o
npm ERR!   CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o
npm ERR!   CC(target) Release/obj.target/libusb/libusb/libusb/io.o
npm ERR!   CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o
npm ERR!   CC(target) Release/obj.target/libusb/libusb/libusb/sync.o
npm ERR!   CC(target) Release/obj.target/libusb/libusb/libusb/os/events_posix.o
npm ERR!   CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o
npm ERR!   CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o
npm ERR!   CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o
npm ERR! make: Leaving directory '/root/homebridge/node_modules/usb/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | arm64
npm ERR! gyp info find Python using Python version 3.11.8 found at "/run/current-system/sw/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v20.11.1/node-v20.11.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v20.11.1/node-v20.11.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v20.11.1/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v20.11.1/SHASUMS256.txt
npm ERR! gyp info spawn /run/current-system/sw/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/nix/store/4r6qr0bzmkdjjjaf7i4vbjmf92l9zpq0-nodejs-20.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/root/homebridge/node_modules/usb/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/nix/store/4r6qr0bzmkdjjjaf7i4vbjmf92l9zpq0-nodejs-20.11.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/root/.cache/node-gyp/20.11.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/20.11.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/nix/store/4r6qr0bzmkdjjjaf7i4vbjmf92l9zpq0-nodejs-20.11.1/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/20.11.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/root/homebridge/node_modules/usb',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! ../libusb/libusb/os/linux_udev.c:28:10: fatal error: libudev.h: No such file or directory
npm ERR!    28 | #include <libudev.h>
npm ERR!       |          ^~~~~~~~~~~
npm ERR! compilation terminated.
npm ERR! make: *** [libusb.target.mk:147: Release/obj.target/libusb/libusb/libusb/os/linux_udev.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/nix/store/4r6qr0bzmkdjjjaf7i4vbjmf92l9zpq0-nodejs-20.11.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Linux 6.6.28-v8-16k+
npm ERR! gyp ERR! command "/nix/store/4r6qr0bzmkdjjjaf7i4vbjmf92l9zpq0-nodejs-20.11.1/bin/node" "/nix/store/4r6qr0bzmkdjjjaf7i4vbjmf92l9zpq0-nodejs-20.11.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /root/homebridge/node_modules/usb
npm ERR! gyp ERR! node -v v20.11.1
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok

I would have thought because this is a user space thing, its less linux tied.

Change baud rate during run time?

I have a need to go from 250k baud to 2m baud during run time. Any suggestions?

I came up with this but I'm missing the data because it is sent so quickly in between baud changes:

const fillBuffer = (chunk) => {
  for (let i = 0; i < chunk.length; ++i) {
    buffer[pointer] = chunk[i]
    pointer += 1
    if (pointer === 4096) {
      console.log('warning: buffer wrapped')
      pointer = 0
    }
  }
}

const initConnection = async (baudRate) => {
  const connection = new CP2102(0x10c4, 0xea60, { baudRate })
  await new Promise((resolve, reject) => connection.on('ready', resolve))
  connection.on('data', fillBuffer)
  return connection
}

let connection = await initConnection(250000)
...
await new Promise((resolve, reject) => connection.close(resolve))
connection.off('data', fillBuffer)
connection = await initConnection(2000000)

Argument order in constructor

Hello!

The README states that product id precedes vendor id, but the source code for the cp2102 class states the order is the opposite.

Maybe you could find some time to correct the corresponding README line.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.