hybridgroup / artoo-raspi

Artoo adaptor for the Raspberry Pi
http://artoo.io
Other
33 stars 2 forks source link

Errno::EBUSY: Device or resource busy @ fptr_finalize - /sys/class/gpio/export #11

Closed banchee closed 8 years ago

banchee commented 8 years ago

Hey,

So I have picked up that the raspi_pins are not being cleaned up along with pwm_pins in the raspi achor

see code below

def disconnect
  puts "Disconnecting all PWM pins..."
  release_all_pwm_pins
  super
end

I believe the following should be added to sort out the error above

def disconnect
  puts "Disconnecting all PWM pins..."
  release_all_pwm_pins
  puts "Disconnecting all Raspi pins..."
  close_all_raspi_pins
  super
end

# new method
def close_all_raspi_pins
  pins.each_value { |pin| pin.close }
end

Hope this is all in order, please also see the error stack

/home/pi/.rvm/gems/ruby-2.2.1/gems/artoo-1.8.1/lib/artoo/adaptors/io/digital_pin.rb:16:in close
/home/pi/.rvm/gems/ruby-2.2.1/gems/artoo-1.8.1/lib/artoo/adaptors/io/digital_pin.rb:16:in open
/home/pi/.rvm/gems/ruby-2.2.1/gems/artoo-1.8.1/lib/artoo/adaptors/io/digital_pin.rb:16:in initialize
/home/pi/.rvm/gems/ruby-2.2.1/gems/artoo-raspi-0.6.1/lib/artoo/adaptors/raspi.rb:120:in new
/home/pi/.rvm/gems/ruby-2.2.1/gems/artoo-raspi-0.6.1/lib/artoo/adaptors/raspi.rb:120:in raspi_pin
/home/pi/.rvm/gems/ruby-2.2.1/gems/artoo-raspi-0.6.1/lib/artoo/adaptors/raspi.rb:87:in digital_write
/home/pi/.rvm/gems/ruby-2.2.1/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in public_send
/home/pi/.rvm/gems/ruby-2.2.1/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in dispatch
/home/pi/.rvm/gems/ruby-2.2.1/gems/celluloid-0.16.0/lib/celluloid/calls.rb:63:in dispatch
/home/pi/.rvm/gems/ruby-2.2.1/gems/celluloid-0.16.0/lib/celluloid/cell.rb:60:in block in invoke
/home/pi/.rvm/gems/ruby-2.2.1/gems/celluloid-0.16.0/lib/celluloid/cell.rb:71:in block in task
/home/pi/.rvm/gems/ruby-2.2.1/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in block in task
/home/pi/.rvm/gems/ruby-2.2.1/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in block in initialize
/home/pi/.rvm/gems/ruby-2.2.1/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in block in create

I believe the error is being caused because the pins are not being shutdown correctly when an adaptor is destroyed or discarded. But I could be wrong, if this is not a bug or issue. Please do you mind guiding me in the right direction to how one gets around this or if there is known fix already

Thanks