summaryrefslogtreecommitdiffstats
path: root/samples
AgeCommit message (Expand)Author
2014-10-08Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-nextLinus Torvalds
2014-10-01bpf: add tests to verifier testsuiteAlexei Starovoitov
2014-09-26bpf: mini eBPF library, test stubs and verifier testsuiteAlexei Starovoitov
2014-09-26kprobes: update jprobe_example.c for do_fork() changeMichael Ellerman
2014-07-01tracing: Change trace event sample to use strlcpy instead of strncpyZhao Hongjiang
2014-06-21tracing: Add __field_struct macro for TRACE_EVENT()Steven Rostedt
2014-05-14samples/kobject/: avoid world-writable sysfs files.Rusty Russell
2014-04-03samples/seccomp/Makefile: do not build tests if cross-compiling for MIPSMarkos Chandras
2013-12-03kobject: fix kset sample error pathBjorn Helgaas
2013-11-15kfifo API type safetyStefani Seibold
2013-09-06Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tileLinus Torvalds
2013-09-06Merge branches 'for-3.12/devm', 'for-3.12/i2c-hid', 'for-3.12/i2c-hid-dt', 'f...Jiri Kosina
2013-09-04HID: uhid: improve uhid example clientDavid Herrmann
2013-08-30tile: support kprobes on tilegxTony Lu
2013-08-20HID: samples/hidraw: add .gitignore filePaul Gortmaker
2013-03-27HID: hidraw: warn if userspace headers are outdatedJiri Kosina
2013-02-19Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kern...Linus Torvalds
2013-02-05samples/seccomp: be less stupid about cross compilingArnd Bergmann
2013-01-25tracing: Remove tracepoint sample codeSteven Rostedt
2013-01-03misc: remove __dev* attributes.Greg Kroah-Hartman
2012-09-12samples/seccomp: fix 31 bit build on s390Heiko Carstens
2012-08-17Merge tag 'v3.6-rc2' into nextJames Morris
2012-08-03samples/seccomp: fix endianness bug in LO_ARG defineHeiko Carstens
2012-07-24Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jik...Linus Torvalds
2012-06-29samples: seccomp: add .gitignore for untracked executablesChad Williamson
2012-06-18HID: uhid: add example programDavid Herrmann
2012-04-19samples/seccomp: fix dependencies on arch macrosWill Drewry
2012-04-14Documentation: prctl/seccomp_filterWill Drewry
2012-02-08samples/rpmsg: add an rpmsg driver sampleOhad Ben-Cohen
2011-10-31samples: drop unused Kconfig symbolPaul Bolle
2011-07-01perf: Add context field to perf_eventAvi Kivity
2011-07-01perf: Remove the nmi parameter from the swevent and overflow interfacePeter Zijlstra
2011-05-23Merge branches 'doc', 'multitouch', 'upstream' and 'upstream-fixes' into for-...Jiri Kosina
2011-04-21HID: hid-example: fix some build issuesRandy Dunlap
2011-04-09HID: hidraw: fix samples miscompilationJiri Kosina
2011-03-31Fix common misspellingsLucas De Marchi
2011-03-22HID: Documentation for hidrawAlan Ott
2010-10-29kdb: Add kdb kernel module sampleJason Wessel
2010-10-22Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bklLinus Torvalds
2010-10-15llseek: automatically add .llseek fopArnd Bergmann
2010-10-01kfifo: fix scatterlist usageIra W. Snyder
2010-08-20kfifo: add explicit error checking in all the examplesAndrea Righi
2010-08-20kfifo: fix a memory leak in dma exampleAndrea Righi
2010-08-20kfifo: fix kernel BUG in dma exampleAndrea Righi
2010-08-20kfifo: add explicit error checking in byte stream exampleAndrea Righi
2010-08-20kfifo: add kfifo_skip() testcaseAndrea Righi
2010-08-11kfifo: add example files to the kernel sample directoryStefani Seibold
2010-08-05SAMPLES: kprobe_example: Make it print something on MIPS.David Daney
2010-05-14tracing: Let tracepoints have data passed to tracepoint callbacksSteven Rostedt
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking imp...Tejun Heo
#include <linux/module.h> #include "hid-ids.h" #define CP_RDESC_SWAPPED_MIN_MAX 0x01 #define CP_2WHEEL_MOUSE_HACK 0x02 #define CP_2WHEEL_MOUSE_HACK_ON 0x04 /* * Some USB barcode readers from cypress have usage min and usage max in * the wrong order */ static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) { unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); unsigned int i; if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX)) return rdesc; for (i = 0; i < *rsize - 4; i++) if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) { __u8 tmp; rdesc[i] = 0x19; rdesc[i + 2] = 0x29; tmp = rdesc[i + 3]; rdesc[i + 3] = rdesc[i + 1]; rdesc[i + 1] = tmp; } return rdesc; } static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); if (!(quirks & CP_2WHEEL_MOUSE_HACK)) return 0; if (usage->type == EV_REL && usage->code == REL_WHEEL) set_bit(REL_HWHEEL, *bit); if (usage->hid == 0x00090005) return -1; return 0; } static int cp_event(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value) { unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput || !usage->type || !(quirks & CP_2WHEEL_MOUSE_HACK)) return 0; if (usage->hid == 0x00090005) { if (value) quirks |= CP_2WHEEL_MOUSE_HACK_ON; else quirks &= ~CP_2WHEEL_MOUSE_HACK_ON; hid_set_drvdata(hdev, (void *)quirks); return 1; } if (usage->code == REL_WHEEL && (quirks & CP_2WHEEL_MOUSE_HACK_ON)) { struct input_dev *input = field->hidinput->input; input_event(input, usage->type, REL_HWHEEL, value); return 1; } return 0; } static int cp_probe(struct hid_device *hdev, const struct hid_device_id *id) { unsigned long quirks = id->driver_data; int ret; hid_set_drvdata(hdev, (void *)quirks); ret = hid_parse(hdev); if (ret) { dev_err(&hdev->dev, "parse failed\n"); goto err_free; } ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); if (ret) { dev_err(&hdev->dev, "hw start failed\n"); goto err_free; } return 0; err_free: return ret; } static const struct hid_device_id cp_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1), .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2), .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3), .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE), .driver_data = CP_2WHEEL_MOUSE_HACK }, { } }; MODULE_DEVICE_TABLE(hid, cp_devices); static struct hid_driver cp_driver = { .name = "cypress", .id_table = cp_devices, .report_fixup = cp_report_fixup, .input_mapped = cp_input_mapped, .event = cp_event, .probe = cp_probe, }; static int __init cp_init(void) { return hid_register_driver(&cp_driver); } static void __exit cp_exit(void) { hid_unregister_driver(&cp_driver); } module_init(cp_init); module_exit(cp_exit); MODULE_LICENSE("GPL");