Skip to content

Instantly share code, notes, and snippets.

View felixgomez's full-sized avatar
🏠
Working from home

Félix Gómez felixgomez

🏠
Working from home
View GitHub Profile
#!/usr/bin/env python3
import usb.core
dev = usb.core.find(idVendor=0x045e, idProduct=0x028e)
if dev is None:
raise ValueError('Device not found')
else:
dev.ctrl_transfer(0xc1, 0x01, 0x0100, 0x00, 0x14)
@felixgomez
felixgomez / symfony3-rest-api.md
Created August 4, 2019 10:49 — forked from diegonobre/symfony3-rest-api.md
Basic RESTful API with Symfony 3 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 3 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authenticationu
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 3 framework. The following SF2 bundles are used :

@felixgomez
felixgomez / patch
Created February 16, 2018 09:09
Xin-Mo patch
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 9369602..2458687 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2052,6 +2052,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET) },
{ HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_THT_2P_ARCADE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
@felixgomez
felixgomez / hid-xinmo.c
Created February 16, 2018 09:08
Xim-Mo driver to patch
/*
* HID driver for Xin-Mo devices, currently only the Dual Arcade controller.
* Fixes the negative axis event values (the devices sends -2) to match the
* logical axis minimum of the HID report descriptor (the report announces
* -1). It is needed because hid-input discards out of bounds values.
* (This module is based on "hid-saitek" and "hid-lg".)
*
* Copyright (c) 2013 Olivier Scherler
*/