ffi-serial 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ffi-serial/posix.rb +3 -27
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 171e00de20624479f57c484dde3675d6020564af
|
4
|
+
data.tar.gz: 72cd514955beeb975a37afe754d45e2684b2459d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ffa5a7365668b12655c78042db290c60f617ed9e9c128c1b384b3bcbc9eabb643c98c111d8a6fe421c3f603704b4144212825a727f1a8021b088e98eb62d36e
|
7
|
+
data.tar.gz: 648ae77871fb16e3317e8f3815eedd95a6823ca1b5bf51cb06b3251ff0c5a24a629d4e4f44bed79e3b72d7a497c3c2393bd7a8ecbb918a3c3405916d031b5655
|
data/lib/ffi-serial/posix.rb
CHANGED
@@ -61,37 +61,13 @@ module Serial #:nodoc:
|
|
61
61
|
# It seems like VMIN and VTIME is broken :(
|
62
62
|
# So this seems to be the only way to implement read the way it should be
|
63
63
|
def read(length = nil, buffer = nil) #:nodoc:
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
if buffer.nil?
|
68
|
-
return super
|
69
|
-
else
|
70
|
-
return super(nil, buffer)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
read_count = 0
|
75
|
-
data_read = []
|
76
|
-
while(length > read_count)
|
77
|
-
IO.select([self]) # Block
|
78
|
-
data_read << (partial_read = super(length))
|
79
|
-
read_count += partial_read.length
|
80
|
-
end
|
81
|
-
|
82
|
-
data_read = data_read.join
|
83
|
-
return data_read if buffer.nil?
|
84
|
-
buffer.gsub!(buffer, data_read) # :sigh: not sure how to do this better
|
85
|
-
buffer
|
64
|
+
IO.select([self]) # Block
|
65
|
+
super(length, buffer)
|
86
66
|
end
|
87
67
|
|
88
68
|
def readpartial(length, buffer = nil) #:nodoc:
|
89
69
|
IO.select([self]) # Block
|
90
|
-
|
91
|
-
super(length)
|
92
|
-
else
|
93
|
-
super(length, buffer)
|
94
|
-
end
|
70
|
+
super(length, buffer)
|
95
71
|
end
|
96
72
|
|
97
73
|
def baud #:nodoc:
|