 
 ;;;;; CONFIGURATION ;;;;;
 
-(def ^:private library-name
-  "JNI library to load when finding devices."
-  "hidapi-jni-64")
-
-
 (def ^:private ^:const poll-period
   "Milliseconds to wait for new input from USB device."
   100)


;;;;; HELPER FUNCTIONS ;;;;;

(defn device-info
  "Builds a map with a device's manufacturer, product, and serial number."
  [^HIDDevice device]
  (when device
    {:manufacturer (.getManufacturerString device)
     :product (.getProductString device)
     :serial (.getSerialNumberString device)}))


(defn find-device
  [vendor-id product-id]
  (try
    (clojure.lang.RT/loadLibrary library-name)
    ; TODO: release the manager?
    (when-let [manager (HIDManager/getInstance)]
      (.openById manager vendor-id product-id nil))
    (catch UnsatisfiedLinkError e
      (log/error e "Failed to load USB library!")
      nil)
    (catch NullPointerException e
      (log/warn (str "No USB input device present matching "

      (log/error e "Error loading USB input device!")
      nil)))


(defn device-info
  "Builds a map with a device's manufacturer, product, and serial number."
  [^HIDDevice device]
  (when device
    {:manufacturer (.getManufacturerString device)
     :product (.getProductString device)
     :serial (.getSerialNumberString device)}))



;;;;; INPUT HANDLING ;;;;;

(defn- read-loop
  "Constructs a new runnable looping function which reads the device state and
