beaglebone 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/beaglebone.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'beaglebone'
3
- s.version = '1.1.2'
3
+ s.version = '1.1.3'
4
4
  s.date = '2014-04-13'
5
5
  s.summary = 'Beaglebone IO Gem'
6
6
  s.description = 'A Full Featured Beaglebone IO Gem'
@@ -191,7 +191,15 @@ module Beaglebone #:nodoc:
191
191
  spi_fd = get_spi_status(spi, :fd_spi)
192
192
 
193
193
  spi_fd.ioctl(SPI_IOC_WR_MAX_SPEED_HZ, [speed].pack('L'))
194
- spi_fd.ioctl(SPI_IOC_RD_MAX_SPEED_HZ, [speed].pack('L'))
194
+
195
+ # deal with old versions of ruby that can't handle large number IOCTL
196
+ # https://bugs.ruby-lang.org/issues/6127
197
+ begin
198
+ spi_fd.ioctl(SPI_IOC_RD_MAX_SPEED_HZ, [speed].pack('L'))
199
+ rescue
200
+ puts 'Warning, old Ruby detected, cannot set SPI max read speed'
201
+ end
202
+
195
203
  set_spi_status(spi, :speed, speed)
196
204
  end
197
205
 
@@ -204,8 +212,15 @@ module Beaglebone #:nodoc:
204
212
  raise ArgumentError, "Mode (#{mode.to_s}) is unknown" unless [SPI_MODE_0, SPI_MODE_1, SPI_MODE_2, SPI_MODE_3].include?(mode)
205
213
  spi_fd = get_spi_status(spi, :fd_spi)
206
214
 
207
- spi_fd.ioctl(SPI_IOC_WR_MODE, [mode].pack('C'))
208
- spi_fd.ioctl(SPI_IOC_RD_MODE, [mode].pack('C'))
215
+ # deal with old versions of ruby that can't handle large number IOCTL
216
+ # https://bugs.ruby-lang.org/issues/6127
217
+ begin
218
+ spi_fd.ioctl(SPI_IOC_WR_MODE, [mode].pack('C'))
219
+ spi_fd.ioctl(SPI_IOC_RD_MODE, [mode].pack('C'))
220
+ rescue
221
+ puts 'Warning, old Ruby detected, cannot set SPI mode'
222
+ end
223
+
209
224
  end
210
225
 
211
226
  # Set the bits per word of the specified SPI device
@@ -220,7 +235,15 @@ module Beaglebone #:nodoc:
220
235
  spi_fd = get_spi_status(spi, :fd_spi)
221
236
 
222
237
  spi_fd.ioctl(SPI_IOC_WR_BITS_PER_WORD, [bpw].pack('C'))
223
- spi_fd.ioctl(SPI_IOC_RD_BITS_PER_WORD, [bpw].pack('C'))
238
+
239
+ # deal with old versions of ruby that can't handle large number IOCTL
240
+ # https://bugs.ruby-lang.org/issues/6127
241
+ begin
242
+ spi_fd.ioctl(SPI_IOC_RD_BITS_PER_WORD, [bpw].pack('C'))
243
+ rescue
244
+ puts 'Warning, old Ruby detected, cannot set SPI read bits per word'
245
+ end
246
+
224
247
  set_spi_status(spi, :bpw, bpw)
225
248
  end
226
249
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaglebone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: