revdev 0.1.2 → 0.1.3

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.
@@ -132,10 +132,14 @@ void Init_revdev(void)
132
132
  rb_define_const(module_revdev, "EVIOCSREP", LONG2FIX(EVIOCSREP));
133
133
  /* get keycode */
134
134
  rb_define_const(module_revdev, "EVIOCGKEYCODE", LONG2FIX(EVIOCGKEYCODE));
135
+ #ifdef EVIOCGKEYCODE_V2
135
136
  rb_define_const(module_revdev, "EVIOCGKEYCODE_V2", LONG2FIX(EVIOCGKEYCODE_V2));
137
+ #endif
136
138
  /* set keycode */
137
139
  rb_define_const(module_revdev, "EVIOCSKEYCODE", LONG2FIX(EVIOCSKEYCODE));
140
+ #ifdef EVIOCSKEYCODE_V2
138
141
  rb_define_const(module_revdev, "EVIOCSKEYCODE_V2", LONG2FIX(EVIOCSKEYCODE_V2));
142
+ #endif
139
143
 
140
144
  /* get device name */
141
145
  rb_define_const(module_revdev, "EVIOCGNAME", LONG2FIX(EVIOCGNAME(BUFF_SIZE)));
@@ -143,8 +147,10 @@ void Init_revdev(void)
143
147
  rb_define_const(module_revdev, "EVIOCGPHYS", LONG2FIX(EVIOCGPHYS(BUFF_SIZE)));
144
148
  /* get unique identifier */
145
149
  rb_define_const(module_revdev, "EVIOCGUNIQ", LONG2FIX(EVIOCGUNIQ(BUFF_SIZE)));
150
+ #ifdef EVIOCGPROP
146
151
  /* get device properties */
147
152
  rb_define_const(module_revdev, "EVIOCGPROP", LONG2FIX(EVIOCGPROP(BUFF_SIZE)));
153
+ #endif
148
154
  /* get global key state */
149
155
  rb_define_const(module_revdev, "EVIOCGKEY", LONG2FIX(EVIOCGKEY(BUFF_SIZE)));
150
156
  /* get all LEDs */
@@ -174,13 +180,24 @@ void Init_revdev(void)
174
180
  * Device properties and quirks
175
181
  */
176
182
 
183
+ #ifdef INPUT_PROP_POINTER
177
184
  rb_define_const(module_revdev, "INPUT_PROP_POINTER", INT2NUM(INPUT_PROP_POINTER));/* needs a pointer */
185
+ #endif
186
+ #ifdef INPUT_PROP_DIRECT
178
187
  rb_define_const(module_revdev, "INPUT_PROP_DIRECT", INT2NUM(INPUT_PROP_DIRECT));/* direct input devices */
188
+ #endif
189
+ #ifdef INPUT_PROP_BUTTONPAD
179
190
  rb_define_const(module_revdev, "INPUT_PROP_BUTTONPAD", INT2NUM(INPUT_PROP_BUTTONPAD));/* has button(s) under pad */
191
+ #endif
192
+ #ifdef INPUT_PROP_SEMI_MT
180
193
  rb_define_const(module_revdev, "INPUT_PROP_SEMI_MT", INT2NUM(INPUT_PROP_SEMI_MT));/* touch rectangle only */
181
-
194
+ #endif
195
+ #ifdef INPUT_PROP_MAX
182
196
  rb_define_const(module_revdev, "INPUT_PROP_MAX", INT2NUM(INPUT_PROP_MAX));
197
+ #endif
198
+ #ifdef INPUT_PROP_CNT
183
199
  rb_define_const(module_revdev, "INPUT_PROP_CNT", INT2NUM(INPUT_PROP_CNT));
200
+ #endif
184
201
 
185
202
  /*
186
203
  * Event types
@@ -208,7 +225,9 @@ void Init_revdev(void)
208
225
  rb_define_const(module_revdev, "SYN_REPORT", INT2NUM(SYN_REPORT));
209
226
  rb_define_const(module_revdev, "SYN_CONFIG", INT2NUM(SYN_CONFIG));
210
227
  rb_define_const(module_revdev, "SYN_MT_REPORT", INT2NUM(SYN_MT_REPORT));
228
+ #ifdef SYN_DROPPED
211
229
  rb_define_const(module_revdev, "SYN_DROPPED", INT2NUM(SYN_DROPPED));
230
+ #endif
212
231
 
213
232
  /*
214
233
  * Keys and buttons
@@ -477,7 +496,9 @@ void Init_revdev(void)
477
496
  rb_define_const(module_revdev, "KEY_DISPLAY_OFF", INT2NUM(KEY_DISPLAY_OFF));/* display device to off state */
478
497
 
479
498
  rb_define_const(module_revdev, "KEY_WIMAX", INT2NUM(KEY_WIMAX));
499
+ #ifdef KEY_RFKILL
480
500
  rb_define_const(module_revdev, "KEY_RFKILL", INT2NUM(KEY_RFKILL));/* Key that controls all radios */
501
+ #endif
481
502
 
482
503
  /* Code 255 is reserved for special needs of AT keyboard driver */
483
504
 
@@ -645,9 +666,15 @@ void Init_revdev(void)
645
666
  rb_define_const(module_revdev, "KEY_FRAMEFORWARD", INT2NUM(KEY_FRAMEFORWARD));
646
667
  rb_define_const(module_revdev, "KEY_CONTEXT_MENU", INT2NUM(KEY_CONTEXT_MENU));/* GenDesc - system context menu */
647
668
  rb_define_const(module_revdev, "KEY_MEDIA_REPEAT", INT2NUM(KEY_MEDIA_REPEAT));/* Consumer - transport control */
669
+ #ifdef KEY_10CHANNELSUP
648
670
  rb_define_const(module_revdev, "KEY_10CHANNELSUP", INT2NUM(KEY_10CHANNELSUP));/* 10 channels up (10+) */
671
+ #endif
672
+ #ifdef KEY_10CHANNELSDOWN
649
673
  rb_define_const(module_revdev, "KEY_10CHANNELSDOWN", INT2NUM(KEY_10CHANNELSDOWN));/* 10 channels down (10-) */
674
+ #endif
675
+ #ifdef KEY_IMAGES
650
676
  rb_define_const(module_revdev, "KEY_IMAGES", INT2NUM(KEY_IMAGES));/* AL Image Browser */
677
+ #endif
651
678
 
652
679
  rb_define_const(module_revdev, "KEY_DEL_EOL", INT2NUM(KEY_DEL_EOL));
653
680
  rb_define_const(module_revdev, "KEY_DEL_EOS", INT2NUM(KEY_DEL_EOS));
@@ -700,20 +727,29 @@ void Init_revdev(void)
700
727
  rb_define_const(module_revdev, "KEY_NUMERIC_STAR", INT2NUM(KEY_NUMERIC_STAR));
701
728
  rb_define_const(module_revdev, "KEY_NUMERIC_POUND", INT2NUM(KEY_NUMERIC_POUND));
702
729
 
730
+ #ifdef KEY_CAMERA_FOCUS
703
731
  rb_define_const(module_revdev, "KEY_CAMERA_FOCUS", INT2NUM(KEY_CAMERA_FOCUS));
732
+ #endif
733
+ #ifdef KEY_WPS_BUTTON
704
734
  rb_define_const(module_revdev, "KEY_WPS_BUTTON", INT2NUM(KEY_WPS_BUTTON));/* WiFi Protected Setup key */
735
+ #endif
705
736
 
737
+ #ifdef KEY_TOUCHPAD_TOGGLE
706
738
  rb_define_const(module_revdev, "KEY_TOUCHPAD_TOGGLE", INT2NUM(KEY_TOUCHPAD_TOGGLE));/* Request switch touchpad on or off */
707
739
  rb_define_const(module_revdev, "KEY_TOUCHPAD_ON", INT2NUM(KEY_TOUCHPAD_ON));
708
740
  rb_define_const(module_revdev, "KEY_TOUCHPAD_OFF", INT2NUM(KEY_TOUCHPAD_OFF));
741
+ #endif
709
742
 
743
+ #ifdef KEY_CAMERA_ZOOMIN
710
744
  rb_define_const(module_revdev, "KEY_CAMERA_ZOOMIN", INT2NUM(KEY_CAMERA_ZOOMIN));
711
745
  rb_define_const(module_revdev, "KEY_CAMERA_ZOOMOUT", INT2NUM(KEY_CAMERA_ZOOMOUT));
712
746
  rb_define_const(module_revdev, "KEY_CAMERA_UP", INT2NUM(KEY_CAMERA_UP));
713
747
  rb_define_const(module_revdev, "KEY_CAMERA_DOWN", INT2NUM(KEY_CAMERA_DOWN));
714
748
  rb_define_const(module_revdev, "KEY_CAMERA_LEFT", INT2NUM(KEY_CAMERA_LEFT));
715
749
  rb_define_const(module_revdev, "KEY_CAMERA_RIGHT", INT2NUM(KEY_CAMERA_RIGHT));
750
+ #endif
716
751
 
752
+ #ifdef BTN_TRIGGER_HAPPY
717
753
  rb_define_const(module_revdev, "BTN_TRIGGER_HAPPY", INT2NUM(BTN_TRIGGER_HAPPY));
718
754
  rb_define_const(module_revdev, "BTN_TRIGGER_HAPPY1", INT2NUM(BTN_TRIGGER_HAPPY1));
719
755
  rb_define_const(module_revdev, "BTN_TRIGGER_HAPPY2", INT2NUM(BTN_TRIGGER_HAPPY2));
@@ -755,6 +791,7 @@ void Init_revdev(void)
755
791
  rb_define_const(module_revdev, "BTN_TRIGGER_HAPPY38", INT2NUM(BTN_TRIGGER_HAPPY38));
756
792
  rb_define_const(module_revdev, "BTN_TRIGGER_HAPPY39", INT2NUM(BTN_TRIGGER_HAPPY39));
757
793
  rb_define_const(module_revdev, "BTN_TRIGGER_HAPPY40", INT2NUM(BTN_TRIGGER_HAPPY40));
794
+ #endif
758
795
 
759
796
  /* We avoid low common keys in module aliases so they don't get huge. */
760
797
  rb_define_const(module_revdev, "KEY_MIN_INTERESTING", INT2NUM(KEY_MIN_INTERESTING));
@@ -811,7 +848,9 @@ void Init_revdev(void)
811
848
 
812
849
  rb_define_const(module_revdev, "ABS_MISC", INT2NUM(ABS_MISC));
813
850
 
851
+ #ifdef ABS_MT_SLOT
814
852
  rb_define_const(module_revdev, "ABS_MT_SLOT", INT2NUM(ABS_MT_SLOT));/* MT slot being modified */
853
+ #endif
815
854
  rb_define_const(module_revdev, "ABS_MT_TOUCH_MAJOR", INT2NUM(ABS_MT_TOUCH_MAJOR));/* Major axis of touching ellipse */
816
855
  rb_define_const(module_revdev, "ABS_MT_TOUCH_MINOR", INT2NUM(ABS_MT_TOUCH_MINOR));/* Minor axis (omit if circular) */
817
856
  rb_define_const(module_revdev, "ABS_MT_WIDTH_MAJOR", INT2NUM(ABS_MT_WIDTH_MAJOR));/* Major axis of approaching ellipse */
@@ -822,8 +861,12 @@ void Init_revdev(void)
822
861
  rb_define_const(module_revdev, "ABS_MT_TOOL_TYPE", INT2NUM(ABS_MT_TOOL_TYPE));/* Type of touching device */
823
862
  rb_define_const(module_revdev, "ABS_MT_BLOB_ID", INT2NUM(ABS_MT_BLOB_ID));/* Group a set of packets as a blob */
824
863
  rb_define_const(module_revdev, "ABS_MT_TRACKING_ID", INT2NUM(ABS_MT_TRACKING_ID));/* Unique ID of initiated contact */
864
+ #ifdef ABS_MT_PRESSURE
825
865
  rb_define_const(module_revdev, "ABS_MT_PRESSURE", INT2NUM(ABS_MT_PRESSURE));/* Pressure on contact area */
866
+ #endif
867
+ #ifdef ABS_MT_DISTANCE
826
868
  rb_define_const(module_revdev, "ABS_MT_DISTANCE", INT2NUM(ABS_MT_DISTANCE));/* Contact hover distance */
869
+ #endif
827
870
 
828
871
 
829
872
  rb_define_const(module_revdev, "ABS_MAX", INT2NUM(ABS_MAX));
@@ -844,10 +887,18 @@ void Init_revdev(void)
844
887
  rb_define_const(module_revdev, "SW_LINEOUT_INSERT", INT2NUM(SW_LINEOUT_INSERT));/* set = inserted */
845
888
  rb_define_const(module_revdev, "SW_JACK_PHYSICAL_INSERT", INT2NUM(SW_JACK_PHYSICAL_INSERT));/* set = mechanical switch set */
846
889
  rb_define_const(module_revdev, "SW_VIDEOOUT_INSERT", INT2NUM(SW_VIDEOOUT_INSERT));/* set = inserted */
890
+ #ifdef SW_CAMERA_LENS_COVER
847
891
  rb_define_const(module_revdev, "SW_CAMERA_LENS_COVER", INT2NUM(SW_CAMERA_LENS_COVER));/* set = lens covered */
892
+ #endif
893
+ #ifdef SW_KEYPAD_SLIDE
848
894
  rb_define_const(module_revdev, "SW_KEYPAD_SLIDE", INT2NUM(SW_KEYPAD_SLIDE));/* set = keypad slide out */
895
+ #endif
896
+ #ifdef SW_FRONT_PROXIMITY
849
897
  rb_define_const(module_revdev, "SW_FRONT_PROXIMITY", INT2NUM(SW_FRONT_PROXIMITY));/* set = front proximity sensor active */
898
+ #endif
899
+ #ifdef SW_ROTATE_LOCK
850
900
  rb_define_const(module_revdev, "SW_ROTATE_LOCK", INT2NUM(SW_ROTATE_LOCK));/* set = rotate locked/disabled */
901
+ #endif
851
902
  rb_define_const(module_revdev, "SW_MAX", INT2NUM(SW_MAX));
852
903
  rb_define_const(module_revdev, "SW_CNT", INT2NUM(SW_CNT));
853
904
 
@@ -888,7 +939,9 @@ void Init_revdev(void)
888
939
  rb_define_const(module_revdev, "REP_DELAY", INT2NUM(REP_DELAY));
889
940
  rb_define_const(module_revdev, "REP_PERIOD", INT2NUM(REP_PERIOD));
890
941
  rb_define_const(module_revdev, "REP_MAX", INT2NUM(REP_MAX));
942
+ #ifdef REP_CNT
891
943
  rb_define_const(module_revdev, "REP_CNT", INT2NUM(REP_CNT));
944
+ #endif
892
945
 
893
946
  /*
894
947
  * Sounds
@@ -928,14 +981,18 @@ void Init_revdev(void)
928
981
  rb_define_const(module_revdev, "BUS_HOST", INT2NUM(BUS_HOST));
929
982
  rb_define_const(module_revdev, "BUS_GSC", INT2NUM(BUS_GSC));
930
983
  rb_define_const(module_revdev, "BUS_ATARI", INT2NUM(BUS_ATARI));
984
+ #ifdef BUS_SPI
931
985
  rb_define_const(module_revdev, "BUS_SPI", INT2NUM(BUS_SPI));
986
+ #endif
932
987
 
933
988
  /*
934
989
  * MT_TOOL types
935
990
  */
936
991
  rb_define_const(module_revdev, "MT_TOOL_FINGER", INT2NUM(MT_TOOL_FINGER));
937
992
  rb_define_const(module_revdev, "MT_TOOL_PEN", INT2NUM(MT_TOOL_PEN));
993
+ #ifdef MT_TOOL
938
994
  rb_define_const(module_revdev, "MT_TOOL_MAX", INT2NUM(MT_TOOL_MAX));
995
+ #endif
939
996
 
940
997
  /*
941
998
  * Values describing the status of a force-feedback effect
@@ -46,8 +46,10 @@ module Revdev
46
46
  read_ioctl_as_string_with EVIOCGUNIQ
47
47
  end
48
48
 
49
- def device_prop
50
- read_ioctl_as_string_with EVIOCGPROP
49
+ if const_defined? :EVIOCGPROP
50
+ def device_prop
51
+ read_ioctl_as_string_with EVIOCGPROP
52
+ end
51
53
  end
52
54
 
53
55
  def global_key_state
@@ -1,3 +1,3 @@
1
1
  module Revdev
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -52,13 +52,14 @@ class EventDeviceTest < Test::Unit::TestCase
52
52
  end
53
53
  end
54
54
 
55
- [:device_name, :physical_location, :uniq_id, :device_prop, :global_key_state,
56
- :all_leds_status, :all_sounds_status, :all_switch_status].each do |m|
55
+ [:device_name, :physical_location, :uniq_id, :global_key_state].each do |m|
57
56
  evdev = EventDevice.new file
58
57
  assert_equal expected_data, evdev.method(m).call
59
58
  end
60
59
  end
61
60
 
61
+ # TODO test all_*_status
62
+
62
63
  def test_read_input_event
63
64
  file = File.new @@target
64
65
  ie = InputEvent.new nil, 1, 2, 3
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revdev
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Keiichiro Ui
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-19 00:00:00 Z
18
+ date: 2012-04-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake