libevdev 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +74 -0
- data/Rakefile +4 -0
- data/evdev_wrap.xml +2715 -0
- data/lib/libevdev.rb +19 -0
- data/lib/libevdev/generated/libevdev.rb +93 -0
- data/lib/libevdev/version.rb +3 -0
- data/libevdev.gemspec +23 -0
- data/swig/libevdev.i +5 -0
- data/tasks/ffi.rake +16 -0
- metadata +100 -0
data/lib/libevdev.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'linux_input'
|
3
|
+
|
4
|
+
require "libevdev/version"
|
5
|
+
|
6
|
+
module Libevdev
|
7
|
+
extend FFI::Library
|
8
|
+
|
9
|
+
ffi_lib 'evdev'
|
10
|
+
|
11
|
+
class_eval File.read(File.join(File.dirname(__FILE__), 'libevdev/generated/libevdev.rb'))
|
12
|
+
end
|
13
|
+
|
14
|
+
class << Libevdev
|
15
|
+
prefix = 'libevdev_'
|
16
|
+
instance_methods(false).each do |method|
|
17
|
+
alias_method method[prefix.length..-1], method
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
READ_FLAG_SYNC = 1
|
2
|
+
READ_FLAG_NORMAL = 2
|
3
|
+
READ_FLAG_FORCE_SYNC = 4
|
4
|
+
READ_FLAG_BLOCKING = 8
|
5
|
+
|
6
|
+
attach_function :libevdev_new, [ ], :pointer
|
7
|
+
attach_function :libevdev_new_from_fd, [ :int, :pointer ], :int
|
8
|
+
attach_function :libevdev_free, [ :pointer ], :void
|
9
|
+
LOG_ERROR = 10
|
10
|
+
LOG_INFO = 20
|
11
|
+
LOG_DEBUG = 30
|
12
|
+
|
13
|
+
callback(:libevdev_log_func_t, [ :int, :pointer, :string, :int, :string, :string, :pointer ], :void)
|
14
|
+
attach_function :libevdev_set_log_function, [ :libevdev_log_func_t, :pointer ], :void
|
15
|
+
attach_function :libevdev_set_log_priority, [ :int ], :void
|
16
|
+
attach_function :libevdev_get_log_priority, [ ], :int
|
17
|
+
callback(:libevdev_device_log_func_t, [ :pointer, :int, :pointer, :string, :int, :string, :string, :pointer ], :void)
|
18
|
+
attach_function :libevdev_set_device_log_function, [ :pointer, :libevdev_device_log_func_t, :int, :pointer ], :void
|
19
|
+
GRAB = 3
|
20
|
+
UNGRAB = 4
|
21
|
+
|
22
|
+
attach_function :libevdev_grab, [ :pointer, :int ], :int
|
23
|
+
attach_function :libevdev_set_fd, [ :pointer, :int ], :int
|
24
|
+
attach_function :libevdev_change_fd, [ :pointer, :int ], :int
|
25
|
+
attach_function :libevdev_get_fd, [ :pointer ], :int
|
26
|
+
READ_STATUS_SUCCESS = 0
|
27
|
+
READ_STATUS_SYNC = 1
|
28
|
+
|
29
|
+
attach_function :libevdev_next_event, [ :pointer, :uint, :pointer ], :int
|
30
|
+
attach_function :libevdev_has_event_pending, [ :pointer ], :int
|
31
|
+
attach_function :libevdev_get_name, [ :pointer ], :string
|
32
|
+
attach_function :libevdev_set_name, [ :pointer, :string ], :void
|
33
|
+
attach_function :libevdev_get_phys, [ :pointer ], :string
|
34
|
+
attach_function :libevdev_set_phys, [ :pointer, :string ], :void
|
35
|
+
attach_function :libevdev_get_uniq, [ :pointer ], :string
|
36
|
+
attach_function :libevdev_set_uniq, [ :pointer, :string ], :void
|
37
|
+
attach_function :libevdev_get_id_product, [ :pointer ], :int
|
38
|
+
attach_function :libevdev_set_id_product, [ :pointer, :int ], :void
|
39
|
+
attach_function :libevdev_get_id_vendor, [ :pointer ], :int
|
40
|
+
attach_function :libevdev_set_id_vendor, [ :pointer, :int ], :void
|
41
|
+
attach_function :libevdev_get_id_bustype, [ :pointer ], :int
|
42
|
+
attach_function :libevdev_set_id_bustype, [ :pointer, :int ], :void
|
43
|
+
attach_function :libevdev_get_id_version, [ :pointer ], :int
|
44
|
+
attach_function :libevdev_set_id_version, [ :pointer, :int ], :void
|
45
|
+
attach_function :libevdev_get_driver_version, [ :pointer ], :int
|
46
|
+
attach_function :libevdev_has_property, [ :pointer, :uint ], :int
|
47
|
+
attach_function :libevdev_enable_property, [ :pointer, :uint ], :int
|
48
|
+
attach_function :libevdev_has_event_type, [ :pointer, :uint ], :int
|
49
|
+
attach_function :libevdev_has_event_code, [ :pointer, :uint, :uint ], :int
|
50
|
+
attach_function :libevdev_get_abs_minimum, [ :pointer, :uint ], :int
|
51
|
+
attach_function :libevdev_get_abs_maximum, [ :pointer, :uint ], :int
|
52
|
+
attach_function :libevdev_get_abs_fuzz, [ :pointer, :uint ], :int
|
53
|
+
attach_function :libevdev_get_abs_flat, [ :pointer, :uint ], :int
|
54
|
+
attach_function :libevdev_get_abs_resolution, [ :pointer, :uint ], :int
|
55
|
+
attach_function :libevdev_get_abs_info, [ :pointer, :uint ], :pointer
|
56
|
+
attach_function :libevdev_get_event_value, [ :pointer, :uint, :uint ], :int
|
57
|
+
attach_function :libevdev_set_event_value, [ :pointer, :uint, :uint, :int ], :int
|
58
|
+
attach_function :libevdev_fetch_event_value, [ :pointer, :uint, :uint, :pointer ], :int
|
59
|
+
attach_function :libevdev_get_slot_value, [ :pointer, :uint, :uint ], :int
|
60
|
+
attach_function :libevdev_set_slot_value, [ :pointer, :uint, :uint, :int ], :int
|
61
|
+
attach_function :libevdev_fetch_slot_value, [ :pointer, :uint, :uint, :pointer ], :int
|
62
|
+
attach_function :libevdev_get_num_slots, [ :pointer ], :int
|
63
|
+
attach_function :libevdev_get_current_slot, [ :pointer ], :int
|
64
|
+
attach_function :libevdev_set_abs_minimum, [ :pointer, :uint, :int ], :void
|
65
|
+
attach_function :libevdev_set_abs_maximum, [ :pointer, :uint, :int ], :void
|
66
|
+
attach_function :libevdev_set_abs_fuzz, [ :pointer, :uint, :int ], :void
|
67
|
+
attach_function :libevdev_set_abs_flat, [ :pointer, :uint, :int ], :void
|
68
|
+
attach_function :libevdev_set_abs_resolution, [ :pointer, :uint, :int ], :void
|
69
|
+
attach_function :libevdev_set_abs_info, [ :pointer, :uint, :pointer ], :void
|
70
|
+
attach_function :libevdev_enable_event_type, [ :pointer, :uint ], :int
|
71
|
+
attach_function :libevdev_disable_event_type, [ :pointer, :uint ], :int
|
72
|
+
attach_function :libevdev_enable_event_code, [ :pointer, :uint, :uint, :pointer ], :int
|
73
|
+
attach_function :libevdev_disable_event_code, [ :pointer, :uint, :uint ], :int
|
74
|
+
attach_function :libevdev_kernel_set_abs_info, [ :pointer, :uint, :pointer ], :int
|
75
|
+
LED_ON = 3
|
76
|
+
LED_OFF = 4
|
77
|
+
|
78
|
+
attach_function :libevdev_kernel_set_led_value, [ :pointer, :uint, :int ], :int
|
79
|
+
attach_function :libevdev_kernel_set_led_values, [ :pointer, :varargs ], :int
|
80
|
+
attach_function :libevdev_set_clock_id, [ :pointer, :int ], :int
|
81
|
+
attach_function :libevdev_event_is_type, [ :pointer, :uint ], :int
|
82
|
+
attach_function :libevdev_event_is_code, [ :pointer, :uint, :uint ], :int
|
83
|
+
attach_function :libevdev_event_type_get_name, [ :uint ], :string
|
84
|
+
attach_function :libevdev_event_code_get_name, [ :uint, :uint ], :string
|
85
|
+
attach_function :libevdev_property_get_name, [ :uint ], :string
|
86
|
+
attach_function :libevdev_event_type_get_max, [ :uint ], :int
|
87
|
+
attach_function :libevdev_event_type_from_name, [ :string ], :int
|
88
|
+
attach_function :libevdev_event_type_from_name_n, [ :string, :uint ], :int
|
89
|
+
attach_function :libevdev_event_code_from_name, [ :uint, :string ], :int
|
90
|
+
attach_function :libevdev_event_code_from_name_n, [ :uint, :string, :uint ], :int
|
91
|
+
attach_function :libevdev_property_from_name, [ :string ], :int
|
92
|
+
attach_function :libevdev_property_from_name_n, [ :string, :uint ], :int
|
93
|
+
attach_function :libevdev_get_repeat, [ :pointer, :pointer, :pointer ], :int
|
data/libevdev.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'libevdev/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "libevdev"
|
8
|
+
spec.version = Libevdev::VERSION
|
9
|
+
spec.authors = ["Christopher Aue"]
|
10
|
+
spec.email = ["mail@christopheraue.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{libevdev bindings for ruby}
|
13
|
+
spec.homepage = "https://github.com/christopheraue/ruby-libevdev"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_runtime_dependency "linux_input", "~> 1.0"
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.8"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
data/swig/libevdev.i
ADDED
data/tasks/ffi.rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
namespace :ffi do
|
2
|
+
desc 'Generate ffi interface'
|
3
|
+
task :generate do
|
4
|
+
`swig -xml -o libevdev_wrap.xml -I/usr/include swig/libevdev.i`
|
5
|
+
|
6
|
+
`ffi-gen libevdev_wrap.xml lib/libevdev/generated/libevdev.rb`
|
7
|
+
|
8
|
+
# simpler method and constant naming
|
9
|
+
`sed -i 's/LIBEVDEV_//g' lib/libevdev/generated/libevdev.rb`
|
10
|
+
|
11
|
+
# manual adjustments
|
12
|
+
`sed -i 's/va_list/:pointer/g' lib/libevdev/generated/libevdev.rb`
|
13
|
+
|
14
|
+
`rm -f libevdev_wrap.xml`
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: libevdev
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Christopher Aue
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: linux_input
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- mail@christopheraue.net
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- evdev_wrap.xml
|
70
|
+
- lib/libevdev.rb
|
71
|
+
- lib/libevdev/generated/libevdev.rb
|
72
|
+
- lib/libevdev/version.rb
|
73
|
+
- libevdev.gemspec
|
74
|
+
- swig/libevdev.i
|
75
|
+
- tasks/ffi.rake
|
76
|
+
homepage: https://github.com/christopheraue/ruby-libevdev
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.4.8
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: libevdev bindings for ruby
|
100
|
+
test_files: []
|