mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 15:14:38 +01:00
```
$> sudo python3
Python 3.7.1 (default, Nov 23 2018, 10:01:49)
[GCC 8.2.1 20181105 (Red Hat 8.2.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hidpp
>>> f = open('/dev/hidraw1', 'r+b')
>>> base = hidpp.hidpp_device()
>>> hidpp.hidpp_device_init(base, f.fileno())
>>> dev = hidpp.hidpp20_device_new(base, 0xff)
>>> hidpp.hidpp20_feature_get_name(0x8100)
'HIDPP_PAGE_ONBOARD_PROFILES'
>>> hidpp.new_uint8_tp()
<Swig Object of type 'uint8_t *' at 0x7f865198fb70>
>>> feature_index = hidpp.new_uint8_tp()
>>> feature_type = hidpp.new_uint8_tp()
>>> feature_version = hidpp.new_uint8_tp()
>>> hidpp.hidpp_root_get_feature(dev, 0x8100, feature_index, feature_type, feature_version)
0
>>> hidpp.uint8_tp_value(feature_index)
14
```
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Filipe Laíns <lains@archlinux.org>
24 lines
602 B
OpenEdge ABL
24 lines
602 B
OpenEdge ABL
/* wrapping libratbag functions from hidpp*.h using SWIG. */
|
|
|
|
%module hidpp
|
|
%{
|
|
/* the resulting C file should be built as a python extension */
|
|
#define SWIG_FILE_WITH_INIT
|
|
/* Includes the header in the wrapper code */
|
|
#include <shared.h>
|
|
#include <hidpp-generic.h>
|
|
#include <hidpp20.h>
|
|
%}
|
|
#define __attribute__(x)
|
|
#define _Static_assert(a,b)
|
|
|
|
|
|
/* Parse the header file to generate wrappers */
|
|
%include "stdint.i"
|
|
%include "cpointer.i"
|
|
%pointer_functions(int, intp);
|
|
%pointer_functions(uint8_t, uint8_tp);
|
|
%pointer_functions(uint16_t, uint16_tp);
|
|
%include "hidpp-generic.h"
|
|
%include "hidpp20.h"
|