ruinput 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 589f2f8f57396adf00e21e73a5ded46397ab5edd
4
+ data.tar.gz: 274d69c7433cbd1d172ac3dc6a8815e95c1985cb
5
+ SHA512:
6
+ metadata.gz: d25a76173ff08fb6323bbe1b119c27a0d9a420b47514479d449482e03f6ba738c7816325501ed3e8837af38247d08a43ed8f4215fd48ca2742ae8f0485b0224d
7
+ data.tar.gz: 651a79db3f2d0b49a2accd3af65e2c216963cd07402ab828cfd339c28e4cb459ac381dcb834cf0add462045dc41606b279919b77a8277b2411823690ece9b049
data/.gitignore CHANGED
@@ -21,3 +21,5 @@ spec/reports
21
21
  test/tmp
22
22
  test/version_tmp
23
23
  tmp
24
+ .ruby-version
25
+ .rbenv-gemsets
@@ -45,7 +45,7 @@ int abs_array_cpy(int abs_arr[], VALUE array_obj)
45
45
  VALUE uinput_user_dev_raw_initalize(VALUE self, VALUE bytes)
46
46
  {
47
47
  struct uinput_user_dev *uud;
48
- uud = RSTRING(bytes)->ptr;
48
+ uud = RSTRING_PTR(bytes);
49
49
  printf("name: %s, ff_effects_max: %d\n", uud->name, uud->ff_effects_max);
50
50
  printf("id.bustype: %d, id.version: %d\n", uud->id.bustype, uud->id.version);
51
51
  printf("firsts-> absmax: %d, absflat: %d \n", uud->absmax[0], uud->absflat[0]);
@@ -113,33 +113,33 @@ void Init_ruinput()
113
113
  /*
114
114
  generated by
115
115
  grep "^#define [A-Z_]* " /usr/include/linux/uinput.h |\
116
- sed -e 's/^#define \([A-Z_]*\) .*./rb_define_const(module_ruinput, "\1", LONG2FIX(\1));/'
116
+ sed -e 's/^#define \([A-Z_]*\) .*./rb_define_const(module_ruinput, "\1", LONG2NUM(\1));/'
117
117
  */
118
- rb_define_const(module_ruinput, "UINPUT_VERSION", LONG2FIX(UINPUT_VERSION));
119
- rb_define_const(module_ruinput, "UINPUT_IOCTL_BASE", LONG2FIX(UINPUT_IOCTL_BASE));
120
- rb_define_const(module_ruinput, "UI_DEV_CREATE", LONG2FIX(UI_DEV_CREATE));
121
- rb_define_const(module_ruinput, "UI_DEV_DESTROY", LONG2FIX(UI_DEV_DESTROY));
122
- rb_define_const(module_ruinput, "UI_SET_EVBIT", LONG2FIX(UI_SET_EVBIT));
123
- rb_define_const(module_ruinput, "UI_SET_KEYBIT", LONG2FIX(UI_SET_KEYBIT));
124
- rb_define_const(module_ruinput, "UI_SET_RELBIT", LONG2FIX(UI_SET_RELBIT));
125
- rb_define_const(module_ruinput, "UI_SET_ABSBIT", LONG2FIX(UI_SET_ABSBIT));
126
- rb_define_const(module_ruinput, "UI_SET_MSCBIT", LONG2FIX(UI_SET_MSCBIT));
127
- rb_define_const(module_ruinput, "UI_SET_LEDBIT", LONG2FIX(UI_SET_LEDBIT));
128
- rb_define_const(module_ruinput, "UI_SET_SNDBIT", LONG2FIX(UI_SET_SNDBIT));
129
- rb_define_const(module_ruinput, "UI_SET_FFBIT", LONG2FIX(UI_SET_FFBIT));
118
+ rb_define_const(module_ruinput, "UINPUT_VERSION", LONG2NUM(UINPUT_VERSION));
119
+ rb_define_const(module_ruinput, "UINPUT_IOCTL_BASE", LONG2NUM(UINPUT_IOCTL_BASE));
120
+ rb_define_const(module_ruinput, "UI_DEV_CREATE", LONG2NUM(UI_DEV_CREATE));
121
+ rb_define_const(module_ruinput, "UI_DEV_DESTROY", LONG2NUM(UI_DEV_DESTROY));
122
+ rb_define_const(module_ruinput, "UI_SET_EVBIT", LONG2NUM(UI_SET_EVBIT));
123
+ rb_define_const(module_ruinput, "UI_SET_KEYBIT", LONG2NUM(UI_SET_KEYBIT));
124
+ rb_define_const(module_ruinput, "UI_SET_RELBIT", LONG2NUM(UI_SET_RELBIT));
125
+ rb_define_const(module_ruinput, "UI_SET_ABSBIT", LONG2NUM(UI_SET_ABSBIT));
126
+ rb_define_const(module_ruinput, "UI_SET_MSCBIT", LONG2NUM(UI_SET_MSCBIT));
127
+ rb_define_const(module_ruinput, "UI_SET_LEDBIT", LONG2NUM(UI_SET_LEDBIT));
128
+ rb_define_const(module_ruinput, "UI_SET_SNDBIT", LONG2NUM(UI_SET_SNDBIT));
129
+ rb_define_const(module_ruinput, "UI_SET_FFBIT", LONG2NUM(UI_SET_FFBIT));
130
130
  // rb_define_const(module_ruinput, "UI_SET_PHYS", rb_str_new2(UI_SET_PHYS)); // fix
131
- rb_define_const(module_ruinput, "UI_SET_SWBIT", LONG2FIX(UI_SET_SWBIT));
132
- rb_define_const(module_ruinput, "UI_SET_PROPBIT", LONG2FIX(UI_SET_PROPBIT));
131
+ rb_define_const(module_ruinput, "UI_SET_SWBIT", LONG2NUM(UI_SET_SWBIT));
132
+ rb_define_const(module_ruinput, "UI_SET_PROPBIT", LONG2NUM(UI_SET_PROPBIT));
133
133
  /*
134
134
  * these consts return "struct uinput_ff_*"
135
- * rb_define_const(module_ruinput, "UI_BEGIN_FF_UPLOAD", LONG2FIX(UI_BEGIN_FF_UPLOAD));
136
- * rb_define_const(module_ruinput, "UI_END_FF_UPLOAD", LONG2FIX(UI_END_FF_UPLOAD));
137
- * rb_define_const(module_ruinput, "UI_BEGIN_FF_ERASE", LONG2FIX(UI_BEGIN_FF_ERASE));
138
- * rb_define_const(module_ruinput, "UI_END_FF_ERASE", LONG2FIX(UI_END_FF_ERASE));
135
+ * rb_define_const(module_ruinput, "UI_BEGIN_FF_UPLOAD", LONG2NUM(UI_BEGIN_FF_UPLOAD));
136
+ * rb_define_const(module_ruinput, "UI_END_FF_UPLOAD", LONG2NUM(UI_END_FF_UPLOAD));
137
+ * rb_define_const(module_ruinput, "UI_BEGIN_FF_ERASE", LONG2NUM(UI_BEGIN_FF_ERASE));
138
+ * rb_define_const(module_ruinput, "UI_END_FF_ERASE", LONG2NUM(UI_END_FF_ERASE));
139
139
  */
140
- rb_define_const(module_ruinput, "EV_UINPUT", LONG2FIX(EV_UINPUT));
141
- rb_define_const(module_ruinput, "UI_FF_UPLOAD", LONG2FIX(UI_FF_UPLOAD));
142
- rb_define_const(module_ruinput, "UI_FF_ERASE", LONG2FIX(UI_FF_ERASE));
143
- rb_define_const(module_ruinput, "UINPUT_MAX_NAME_SIZE", LONG2FIX(UINPUT_MAX_NAME_SIZE));
140
+ rb_define_const(module_ruinput, "EV_UINPUT", LONG2NUM(EV_UINPUT));
141
+ rb_define_const(module_ruinput, "UI_FF_UPLOAD", LONG2NUM(UI_FF_UPLOAD));
142
+ rb_define_const(module_ruinput, "UI_FF_ERASE", LONG2NUM(UI_FF_ERASE));
143
+ rb_define_const(module_ruinput, "UINPUT_MAX_NAME_SIZE", LONG2NUM(UINPUT_MAX_NAME_SIZE));
144
144
  }
145
145
 
@@ -31,15 +31,14 @@ module Ruinput
31
31
  raise ArgumentError, "2nd arg expect Revdev::InputId"
32
32
  end
33
33
 
34
- recognize_as_keyboard
35
- #recognize_as_mouse
36
-
37
34
  uud = UinputUserDev.new({ :name => name, :id => id,
38
35
  :ff_effects_max => 0, :absmax => [20],
39
36
  :absmin => [30], :absfuzz => [4],
40
37
  :absflat => [5] })
41
38
  @file.syswrite uud.to_byte_string
42
39
 
40
+ set_all_events
41
+
43
42
  @file.ioctl UI_DEV_CREATE, nil
44
43
  @is_created = true
45
44
  end
@@ -52,7 +51,7 @@ module Ruinput
52
51
  @file.close
53
52
  end
54
53
 
55
- def recognize_as_keyboard
54
+ def set_all_events
56
55
  if @is_created
57
56
  raise Exception, "invalid method call: this uinput is already created"
58
57
  end
@@ -66,21 +65,17 @@ module Ruinput
66
65
  @file.ioctl UI_SET_MSCBIT, i
67
66
  end
68
67
 
69
- @file.ioctl UI_SET_EVBIT, Revdev::EV_REP
70
- end
71
-
72
- def recognize_as_mouse
73
- if @is_created
74
- raise Exception, "invalid method call: this uinput is already created"
75
- end
76
- @file.ioctl UI_SET_EVBIT, Revdev::EV_KEY
77
- Revdev::KEY_CNT.times do |i|
78
- @file.ioctl UI_SET_KEYBIT, i
68
+ @file.ioctl UI_SET_EVBIT, Revdev::EV_MSC
69
+ Revdev::MSC_CNT.times do |i|
70
+ @file.ioctl UI_SET_MSCBIT, i
79
71
  end
80
- @file.ioctl UI_SET_EVBIT, Revdev::EV_REL
81
- Revdev::REL_CNT.times do |i|
82
- @file.ioctl UI_SET_RELBIT, i
72
+
73
+ @file.ioctl UI_SET_EVBIT, Revdev::EV_ABS
74
+ Revdev::ABS_CNT.times do |i|
75
+ @file.ioctl UI_SET_ABSBIT, i
83
76
  end
77
+
78
+ @file.ioctl UI_SET_EVBIT, Revdev::EV_REP
84
79
  end
85
80
 
86
81
  end
@@ -1,5 +1,6 @@
1
1
  # -*- coding:utf-8; mode:ruby; -*-
2
2
 
3
+ require 'rubygems'
3
4
  require 'revdev/each_values_equal'
4
5
 
5
6
  module Ruinput
@@ -1,3 +1,3 @@
1
1
  module Ruinput
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/ruinput.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.version = Ruinput::VERSION
18
18
  gem.extensions = Dir.glob 'ext/**/extconf.rb'
19
19
 
20
- gem.add_dependency 'revdev', '>= 0.1.0'
20
+ gem.add_dependency 'revdev', '~> 0.2.0'
21
21
  gem.add_development_dependency 'rake'
22
22
  gem.add_development_dependency 'bundler'
23
23
  end
@@ -54,9 +54,9 @@ def main
54
54
 
55
55
  # toggle capslock LED
56
56
  if ie.code == KEY_CAPSLOCK and ie.value == 1
57
- ie = InputEvent.new nil, EV_LED, LED_CAPSL, caps ? 1 : 0
58
- $evdev.write_input_event ie
59
- puts "## light #{ie.value}"
57
+ led_ev = InputEvent.new nil, EV_LED, LED_CAPSL, caps ? 1 : 0
58
+ $evdev.write_input_event led_ev
59
+ puts "## light #{caps}"
60
60
  caps = (not caps)
61
61
  end
62
62
 
metadata CHANGED
@@ -1,76 +1,65 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruinput
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Keiichiro Ui
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-04-21 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2013-07-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: revdev
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 27
29
- segments:
30
- - 0
31
- - 1
32
- - 0
33
- version: 0.1.0
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.0
34
20
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rake
38
21
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 0
47
- version: "0"
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
48
34
  type: :development
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: bundler
52
35
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
62
48
  type: :development
63
- version_requirements: *id003
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
64
55
  description: a ruby binding for uinput.h
65
- email:
56
+ email:
66
57
  - keiichiro.ui@gmail.com
67
58
  executables: []
68
-
69
- extensions:
59
+ extensions:
70
60
  - ext/ruinput/extconf.rb
71
61
  extra_rdoc_files: []
72
-
73
- files:
62
+ files:
74
63
  - .gitignore
75
64
  - Gemfile
76
65
  - LICENSE
@@ -90,38 +79,28 @@ files:
90
79
  - test/test_uinput_user_dev.rb
91
80
  homepage: https://rubygems.org/gems/ruinput
92
81
  licenses: []
93
-
82
+ metadata: {}
94
83
  post_install_message:
95
84
  rdoc_options: []
96
-
97
- require_paths:
85
+ require_paths:
98
86
  - lib
99
- required_ruby_version: !ruby/object:Gem::Requirement
100
- none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
106
- - 0
107
- version: "0"
108
- required_rubygems_version: !ruby/object:Gem::Requirement
109
- none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
115
- - 0
116
- version: "0"
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
117
97
  requirements: []
118
-
119
98
  rubyforge_project:
120
- rubygems_version: 1.7.2
99
+ rubygems_version: 2.0.0
121
100
  signing_key:
122
- specification_version: 3
101
+ specification_version: 4
123
102
  summary: ruinput is a ruby binding for uinput.h.
124
- test_files:
103
+ test_files:
125
104
  - test/test_ruinput.rb
126
105
  - test/test_uinput_device.rb
127
106
  - test/test_uinput_user_dev.rb