mirror of https://github.com/nirenjan/libx52.git
				
				
				
			
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
| /*
 | |
|  * Saitek X52 IO driver - common definitions
 | |
|  *
 | |
|  * Copyright (C) 2012-2020 Nirenjan Krishnan (nirenjan@nirenjan.org)
 | |
|  *
 | |
|  * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0
 | |
|  */
 | |
| 
 | |
| #ifndef IO_COMMON_H
 | |
| #define IO_COMMON_H
 | |
| 
 | |
| #include <stdint.h>
 | |
| #include "libx52io.h"
 | |
| #include "hidapi.h"
 | |
| 
 | |
| // Function handler for parsing reports
 | |
| typedef int (*x52_parse_report)(unsigned char *data, int length, libx52io_report *report);
 | |
| 
 | |
| struct libx52io_context {
 | |
|     hid_device *handle;
 | |
| 
 | |
|     int32_t axis_min[LIBX52IO_AXIS_MAX];
 | |
|     int32_t axis_max[LIBX52IO_AXIS_MAX];
 | |
| 
 | |
|     int16_t vid;
 | |
|     int16_t pid;
 | |
|     int16_t version;
 | |
| 
 | |
|     char *manufacturer;
 | |
|     char *product;
 | |
|     char *serial_number;
 | |
| 
 | |
|     x52_parse_report parser;
 | |
| };
 | |
| 
 | |
| void _x52io_set_axis_range(libx52io_context *ctx);
 | |
| void _x52io_set_report_parser(libx52io_context *ctx);
 | |
| int _x52io_parse_report(libx52io_context *ctx, libx52io_report *report,
 | |
|                         unsigned char *data, int length);
 | |
| 
 | |
| void _x52io_save_device_info(libx52io_context *ctx, struct hid_device_info *dev);
 | |
| void _x52io_release_device_info(libx52io_context *ctx);
 | |
| 
 | |
| #endif // !defined IO_COMMON_H
 |