使用 libusb 的未定义方法 all_input_usages [英] Undefined method all_input_usages using libusb

查看:46
本文介绍了使用 libusb 的未定义方法 all_input_usages的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 libusb 编写了这个小演示代码:

I wrote this little demo code with libusb:

require 'libusb'

usb = LIBUSB::Context.new
device = usb.devices(:idVendor => 2362).first
puts device.all_input_usages

但不知何故我没有收到错误:

But somehow I don't get the error:

 undefined method `all_input_usages' for #<LIBUSB::Device:0x2091fa8>

我做错了什么?

推荐答案

你应该远离那个演示代码,因为它已经过时了,而且 API 已经发生了根本性的变化.

You should step away from that demo code, because it is hopelessly outdated and the API has radically changed since.

当您键入 device.methods - Object.new.methods 时,您可以在 IRB 中看到所有可用的方法,这是我在想探索对象必须提供的内容时经常使用的技巧.也许这会帮助你找到你正在寻找的方法.

You can see all available methods in IRB when you type device.methods - Object.new.methods, it's a trick i often use when i want to explore what an object has to offer. Maybe this will help you find the method you are looking for.

这篇关于使用 libusb 的未定义方法 all_input_usages的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆