Skip to content

Instantly share code, notes, and snippets.

@amitn
amitn / Yoga 2 Pro - Sensors
Created February 4, 2014 07:17
Yoga 2 Pro - Sensors
Hardware Perspective
--------------------
* It is look like that Lenovo has aggregated bunch of sensors into one USB HID Device, this will be `2047:0855 Texas Instruments`.
* This device has a big HID descriptor which report each sensor using `Usage Page 05 20 - Sensor Page (0x20)`
* There are 8 reports in the descriptor, for each report there is a bit map of the sensor properties:
```
Usage 0A 09 03 - Property: Sensor Connection Type
Usage 0A 16 03 - Property: Reporting State
Usage 0A 19 03 - Property: Power State
@amitn
amitn / Android.mk
Created March 20, 2014 06:25
Android screen shot using OpenCV
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# OpenCV
OPENCV_CAMERA_MODULES := off
OPENCV_INSTALL_MODULES := off
OPENCV_LIB_TYPE := STATIC
@amitn
amitn / send_event.c
Created March 20, 2014 15:39
look ma no hands (and cables)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/input.h>
#include <errno.h>
#include <time.h>
@amitn
amitn / CVCreateModel.py
Created December 18, 2014 07:39
Threes solver using OpenCV and Python
#!/usr/bin/python
import cv2
import numpy as np
import glob
SAMPLES_SIZE = 2001
SAMPLES = np.empty((0, SAMPLES_SIZE))
RESPONSES = []
import socket
import time
import binascii
FLASH_FORGE_REMOTE_PORT = 19000
FLASH_FORGE_LOCAL_PORT = 18001
FLASH_FORGE_MULTICAST_GROUP = "225.0.0.9"
def findprinter(src):