npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@xencelabs-quick-keys/node

v1.0.0

Published

An npm module for interfacing with the Xencelabs Quick Keys in node

Downloads

175

Readme

@xencelabs-quick-keys/node

Node CI codecov

npm version license

@xencelabs-quick-keys/node is a shared library for interfacing with the various models of the Xencelabs Quick Keys.

Intended use

This library has nothing to do with the software produced by the manufacturer. There is nothing here to install and run. This is a library to help developers make alternatives to that software

Install

$ npm install --save @xencelabs-quick-keys/node

Native dependencies

All of this library's native dependencies ship with prebuilt binaries, so having a full compiler toolchain should not be necessary to install @xencelabs-quick-keys/node.

However, in the event that installation does fail (or if you are on a platform that our dependencies don't provide prebuilt binaries for, such as a Raspberry Pi), you will need to install a compiler toolchain to enable npm to build some of @xencelabs-quick-keys/node's dependencies from source. Expand the details block below for full instructions on how to do so.

  • Windows
    npm install --global windows-build-tools
  • MacOS
    • Install the Xcode Command Line Tools:
    xcode-select --install
  • Linux (including Raspberry Pi)
    • Follow the instructions for Linux in the "Compiling from source" steps for
    • Try installing @xencelabs-quick-keys/node
    • If you still have issues, ensure everything is updated and try again:
      sudo apt-get update && sudo apt-get upgrade

Linux

On linux, the udev subsystem blocks access to the device without some special configuration. Save the following to /etc/udev/rules.d/50-xencelabs.rules and reload the rules with sudo udevadm control --reload-rules

SUBSYSTEM=="input", GROUP="input", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="28bd", ATTRS{idProduct}=="5202", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="28bd", ATTRS{idProduct}=="5203", MODE:="666", GROUP="plugdev"
KERNEL=="hidraw*", ATTRS{busnum}=="1", ATTRS{idVendor}=="28bd", ATTRS{idProduct}=="5202", MODE="0666"
KERNEL=="hidraw*", ATTRS{busnum}=="1", ATTRS{idVendor}=="28bd", ATTRS{idProduct}=="5203", MODE="0666"

Unplug and replug the device and it should be usable

Features

  • Multiplatform support: Windows, MacOS, Linux, and even Raspberry Pi!
  • Key down and key up events
  • Wheel turn events
  • Set text labels of buttons
  • Show text overlays
  • Set the wheel speed
  • Set the display orientation
  • Set the display brightness
  • Set the wheel color
  • TypeScript support

API

The root methods exposed by the library are as follows. For more information it is recommended to rely on the typescript typings for hints or to browse through the source to see what methods are available

// TODO

The XencelabsQuickKeys type can be found here

Example

import { XencelabsQuickKeysManagerInstance } from '@xencelabs-quick-keys/node'

// start listening for devices
XencelabsQuickKeysManagerInstance.on('connect', async (myDevice) => {
	// Device has connected

	// Open the streams for data read and write
	await myDevice.startData()

	myDevice.on('down', (keyIndex) => {
		console.log('key %d down', keyIndex)
	})

	myDevice.on('up', (keyIndex) => {
		console.log('key %d up', keyIndex)
	})

	// Fired whenever an error is detected by the `node-hid` library.
	// Always add a listener for this event! If you don't, errors will be silently dropped.
	myDevice.on('error', (error) => {
		console.error(error)
	})

	myDevice.on('wheel', (e) => {
		console.log('wheel %s', e)
	})

	// Fill the first button text. This is asynchronous.
	await myDevice.setKeyText(4, 'test')
	console.log('Successfully wrote text to key 4.')
})
XencelabsQuickKeysManagerInstance.on('disconnect', (myDevice) => {
	// Device has disconnected
})

// Prompt the user to grant access to some devices
XencelabsQuickKeysManagerInstance.scanDevices().catch((e) => {
	console.error(`scan failed: ${e}`)
})

Contributing

The xencelabs-quick-keys team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear.

Please refer to the Changelog for project history details, too.