myhidapi 1.0.0 → 1.0.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 +4 -4
- data/ext/myhidapi/myhidapi.c +26 -0
- data/lib/myhidapi.rb +1 -1
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7b42c95cfbc41760445cc99da21e700f5d7fa244a97c5922bced00526c29ddc
|
4
|
+
data.tar.gz: 58d44ef8035a17032b5320029694176a9209fa4f3253f068cad3e59bb0d5807d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e455d59027a327019f06cf8d45ef0ad909765a437da90b9ecccd83903ace5a6f186560caf12f6d3c44b01ce9ae298fd81d4b72a24976c620c864044d91a6e70
|
7
|
+
data.tar.gz: 1235dbfa4f91ebda9153914c50180911f5f6bc2a89d0a8dd15081d38053e76ed352533d7940d4482b48a53afa679b01d94d4f1066bb0118dcf80df61d7d3a50f
|
data/ext/myhidapi/myhidapi.c
CHANGED
@@ -165,6 +165,30 @@ rb_hid_read_timeout(VALUE self, VALUE size, VALUE timeout_ms)
|
|
165
165
|
return ret;
|
166
166
|
}
|
167
167
|
|
168
|
+
static VALUE
|
169
|
+
rb_manufacturer(VALUE self)
|
170
|
+
{
|
171
|
+
hid_device *handle;
|
172
|
+
TypedData_Get_Struct(self, hid_device, &myhidapi_handle_type, handle);
|
173
|
+
|
174
|
+
wchar_t buffer[BUF_SIZE];
|
175
|
+
hid_get_manufacturer_string(handle, buffer, BUF_SIZE);
|
176
|
+
|
177
|
+
return rb_wcstombs(buffer);
|
178
|
+
}
|
179
|
+
|
180
|
+
static VALUE
|
181
|
+
rb_product(VALUE self)
|
182
|
+
{
|
183
|
+
hid_device *handle;
|
184
|
+
TypedData_Get_Struct(self, hid_device, &myhidapi_handle_type, handle);
|
185
|
+
|
186
|
+
wchar_t buffer[BUF_SIZE];
|
187
|
+
hid_get_product_string(handle, buffer, BUF_SIZE);
|
188
|
+
|
189
|
+
return rb_wcstombs(buffer);
|
190
|
+
}
|
191
|
+
|
168
192
|
void Init_myhidapi() {
|
169
193
|
mMyHIDAPI = rb_define_module("MyHIDAPI");
|
170
194
|
cMyHIDAPIHandle = rb_define_class_under(mMyHIDAPI, "Handle", rb_cObject);
|
@@ -175,4 +199,6 @@ void Init_myhidapi() {
|
|
175
199
|
rb_define_method(cMyHIDAPIHandle, "read", rb_hid_read, 1);
|
176
200
|
rb_define_method(cMyHIDAPIHandle, "read_timeout", rb_hid_read_timeout, 2);
|
177
201
|
rb_define_method(cMyHIDAPIHandle, "set_nonblocking", rb_hid_set_nonblocking, 1);
|
202
|
+
rb_define_method(cMyHIDAPIHandle, "manufacturer", rb_manufacturer, 0);
|
203
|
+
rb_define_method(cMyHIDAPIHandle, "product", rb_product, 0);
|
178
204
|
}
|
data/lib/myhidapi.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myhidapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '5.
|
19
|
+
version: '5.14'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '5.
|
26
|
+
version: '5.14'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rdoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '3.
|
53
|
+
version: '3.22'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '3.
|
60
|
+
version: '3.22'
|
61
61
|
description: |-
|
62
62
|
This is a small wrapper around HIDAPI. I couldn't get other HIDAPI wrappers to
|
63
63
|
work, so I wrote this one. I'm using it to communicate with my keyboard, so
|
@@ -85,8 +85,9 @@ files:
|
|
85
85
|
homepage: https://github.com/tenderlove/myhidapi
|
86
86
|
licenses:
|
87
87
|
- MIT
|
88
|
-
metadata:
|
89
|
-
|
88
|
+
metadata:
|
89
|
+
homepage_uri: https://github.com/tenderlove/myhidapi
|
90
|
+
post_install_message:
|
90
91
|
rdoc_options:
|
91
92
|
- "--main"
|
92
93
|
- README.md
|
@@ -103,8 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
104
|
- !ruby/object:Gem::Version
|
104
105
|
version: '0'
|
105
106
|
requirements: []
|
106
|
-
rubygems_version: 3.0.1
|
107
|
-
signing_key:
|
107
|
+
rubygems_version: 3.2.0.rc.1
|
108
|
+
signing_key:
|
108
109
|
specification_version: 4
|
109
110
|
summary: This is a small wrapper around HIDAPI
|
110
111
|
test_files: []
|