Access library for some Cleware devices. It has been tested with these devices:
- Ampel "traffic light" (0d50:0008 v29, v106)
- Contact (0d50:0030 v3)
- IO16 (0d50:0030 v14)
- HIDAPI: Be sure to install the right hidapi library. It comes in two flavors: based on libusb and one called 'raw'. Get hidapi based on libusb if you have to choose one. On Arch Linux you will find one package with both flavors included.
- libc: Needed for converting wide-strings.
- FFI gem
In order to grant users access to Cleware devices you have to give them write access on the corresponding device files /dev/usb/hiddev*
. This can be accomplished by e.g. /etc/udev/rules.d/99-cleware.rules
with following content:
ATTRS{idVendor}=="0d50", MODE="0666"
gem build cleware.gemspec
gem install cleware-0.1.0.gem
require 'sniner/cleware'
include Sniner::Cleware::TrafficLight::Colors
tl = Sniner::Cleware.devices(:product => Sniner::Cleware::PRODUCT_LED).first
tl.open do |dev|
# Setting colors individually
dev.red = true
dev.yellow = true
sleep(1)
# Using a bit mask
dev.leds = RED|GREEN
sleep(1)
# Flipping on/off states
dev.leds ^= ALL
sleep(1)
end
All Cleware gadgets are USB HID class devices. The USB human interface device (HID) class is an abstraction layer while libusb provides low-level access. As far as I know the HID API is the preferred way of accessing Cleware devices, but accessing via libusb does work too. A libusb version is included, but not used by default and is not maintained.
- Folkert van Heusden https://github.com/flok99/clewarecontrol