structure of the rubygem
westonplatter opened this issue · 10 comments
What woul you think of dividing up the libusb library across multiple files according to class relationships?
Yes, you're right. It was a bit cluttered and was already on my agenda.
Are you working on a particular issue regarding to libusb?
No, specific issue, I just wanted to contribute to some projects on GitHub
and work on something beyond my own ideas. All the changes would be slow
and steady.
On another note, do you have any good explanations for configuring the
Transfer params? This is the best explanation that I found.
http://www.jungo.com/st/support/documentation/windriver/802/wdusb_man_mhtml/node55.html
On Tue, Apr 3, 2012 at 2:48 PM, Lars Kanis <
reply@reply.github.com
wrote:
Yes, you're right. It was a bit cluttered and was already on my agenda.
Are you working on a particular issue regarding to libusb?
Reply to this email directly or view it on GitHub:
#2 (comment)
Thanks for your offering! From my point of view, the libusb-gem is quite feature complete, already. The libusb async event API isn't yet implemented, but it's deprecated in the current form anyway, since it doesn't work on Windows. But I couldn't really test the interrupt and isochronous transfers, till now. So if you like, you could write a test case for UVC compatible web cams for example, next to the existing mass storage test (which tests control+bulk only).
I used http://libusb.sourceforge.net/api-1.0/modules.html and http://www.beyondlogic.org/usbnutshell/usb6.shtml to implement libusb-gem.
Thanks for restructuring the gem - I didn't expect you to restructure the code that quick.
I think writing the interupt and isochronus tests is a little beyond my current skill, but I would love to contribute How-Tos about communicating with a device in a wiki if you would want add a wiki to the project.
I can just add wiki info to my fork and send a pull request as I complete pages.
Sorry for the flood of ideas, but would it be better to put examples in the documentation, or in GitHub wiki pages?
Sorry for the flood of ideas, but would it be better to put examples in the documentation, or in GitHub wiki pages?
Both is OK. I would place pregnant and generic descriptions into the
YARD documentation and would place examples, possible use cases or
additional information into the wiki. The latter one isn't existent,
yet, so it would be great, if you could add something. You should be
able to edit the wiki pages directly - they are for public use.
On which OS are you working with libusb? I do development on Linux and
do sporadic tests on Windows.
Regards,
Lars
What do you mean by pregnant descriptions?
I am working on Mac OSX 10.7.3 (2010 MacBook Unibody). But have linux
machine too if needed. Hopefully the Mac OS will create a more diverse
tesing environment.
I am having trouble setting up a bult transfer to read data from a USB
device. Can you provide some input on get a bulk transfer to go through?
https://gist.github.com/83753da31138f43e0da1. I will put the example in the
wiki once I get it working.
-Weston
On Thu, Apr 5, 2012 at 2:35 AM, Lars Kanis <
reply@reply.github.com
wrote:
Sorry for the flood of ideas, but would it be better to put examples in
the documentation, or in GitHub wiki pages?Both is OK. I would place pregnant and generic descriptions into the
YARD documentation and would place examples, possible use cases or
additional information into the wiki. The latter one isn't existent,
yet, so it would be great, if you could add something. You should be
able to edit the wiki pages directly - they are for public use.On which OS are you working with libusb? I do development on Linux and
do sporadic tests on Windows.Regards,
Lars
Reply to this email directly or view it on GitHub:
#2 (comment)
What do you mean by pregnant descriptions?
Oops, that was obviously a funny translation mistake, haha. I meant
short and concise description... I consider the embedded documentation
as a specification about how to install and use the library with all
essential details. Not more and not less.
I am working on Mac OSX 10.7.3 (2010 MacBook Unibody). But have linux
machine too if needed. Hopefully the Mac OS will create a more diverse
tesing environment.
Yes, it's fine to see someone is using and testing on OSX.
I am having trouble setting up a bult transfer to read data from a USB
device. Can you provide some input on get a bulk transfer to go through?
https://gist.github.com/83753da31138f43e0da1. I will put the example in the
wiki once I get it working.
There's nothing obviously wrong with your example, but be sure to use
the right endpoints. Input is something >=0x81 (not 2). You could also
use Context#devices Hash parameter, to select the device.
You may also use DevHandle#clear_hold to unblock the device from any
halt states, which the device is using in case of communication
errors. Some devices become totally blocked on some commands, so you
have to unplug it.
With what kind of device do you communicate? What is your error message?
Regards,
Lars
Why are endpoints greater of equal to 0x81 (hex) or 129 (base 10)?
There's nothing obviously wrong with your example, but be sure to use
the right endpoints. Input is something >=0x81 (not 2). You could also
use Context#devices Hash parameter, to select the device.
Toshiba USB Flash Memory Stick.
With what kind of device do you communicate?
Output is inlcuded here
What is your error message?
/Users/west/.rvm/gems/ruby-1.9.3-p125@skyetek/gems/libusb-0.1.4/lib/libusb/constants.rb:44:in `raise_error': LIBUSB::ERROR_ACCESS in libusb_claim_interface (LIBUSB::ERROR_ACCESS)
from /Users/west/.rvm/gems/ruby-1.9.3-p125@skyetek/gems/libusb-0.1.4/lib/libusb/dev_handle.rb:76:in `claim_interface'
from libusb.rb:62:in `block (2 levels) in <main>'
from libusb.rb:41:in `each'
from libusb.rb:41:in `block in <main>'
from libusb.rb:32:in `each'
from libusb.rb:32:in `<main>'
Can you explain how do determine the endpoint_input and endpoint_output addresses? How do I know what values to put in there?
To accomplish bulk transfer device I need to,
usb = LIBUSB::Context.new
device = usb.devices(:idVendor => 0x04b4, :idProduct => 0x8613).first
device.open do |handle|
handle.claim_interface(0) do
# write to device
handle.bulk_transfer(:endpoint => 0x82, dataOut => "out data")
# read from device
handle.bulk_transfer(:endpoint => 0x01, dataIn => variable_of_my_choosing)
end
end