Code Monkey home page Code Monkey logo

hidraw's Introduction

Hidraw

Hidraw is an Elixir interface to Linux hidraw devices.

Usage

Hidraw can be used to monitor /dev/hidraw* devices and report raw data to the parent process.

Start by looking for the device you want to monitor.

iex> Hidraw.enumerate
[
  {"/dev/hidraw2", "ᄅSymbol Technologies, Inc, 2002 Symbol Bar Code Scanner"},
  {"/dev/hidraw1", "DLL082A:01 06CB:76AF"},
  {"/dev/hidraw0", "ELAN Touchscreen"}
]

Here we have a Barcode scanner at /dev/hidraw2, lets open it.

iex> Hidraw.start_link "/dev/hidraw2"
{:ok, #PID<0.197.0>}

The first message we will receive is the device's report descriptor

iex> flush
{:hidraw, "/dev/hidraw2",
 {:report_descriptor,
  <<6, 69, 255, 10, 0, 75, 161, 1, 10, 1, 74, 117, 8, 149, 11, 21, 0, 38, 255,
    0, 145, 2, 10, 2, 74, 149, 64, 129, 2, 192>>}}

All subsequent messages will be triggered off device events. Here I am scanning a barcode:

iex(4)> flush
{:hidraw, "/dev/hidraw2",
 <<16, 16, 3, 0, 65, 67, 67, 49, 55, 49, 49, 50, 79, 0, 24, 11, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   ...>>}

hidraw's People

Contributors

mobileoverlord avatar

Watchers

James Cloos avatar

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.