wondering about libusb_bulk_transfer error code - return

libusb_open(device, &deviceHandle);
returns 0
but
libusb_bulk_transfer(deviceHandle, 0x81, data1, 512, &len, 0);
return -5
so I try to find error code -5 using printf
LIBUSB_ERROR_TIMEOUT
LIBUSB_ERROR_PIPE
LIBUSB_ERROR_OVERFLOW
LIBUSB_ERROR_NO_DEVICE
LIBUSB_ERROR_IO
LIBUSB_TRANSFER_ERROR
LIBUSB_ERROR_INTERRUPTED
LIBUSB_ERROR_ACCESS
LIBUSB_ERROR_BUSY
LIBUSB_ERROR_NO_MEM
LIBUSB_ERROR_COUNT
LIBUSB_ERROR_INVALID_PARAM
But none... and can't find anywhere in google...
What's the meaning of error code -5 in libusb_bulk_transfer?
Help me!

LibUSB error codes can be found in the libusb documentation, which is available online here.
The functions libusb_error_name and libusb_strerror can also be used to get a string corresponding to the error code.
-5 is LIBUSB_ERROR_NOT_FOUND : Entity not found.
Google suggest checking that you have successfully claimed the interface (you must claim the interface you want to use, with libusb_claim_interface before doing IO).

Related

Ruby gem origami sign signature failed

I'm trying to make the PDF file with signature with origami gem, follow this example https://github.com/gdelugre/origami/blob/master/examples/signature/signature.rb
Now i just run this signature.rb and got error
[error] Breaking on: ">>\nendobj\n..." at offset 0x1f6f3
[error] Last exception: [Origami::InvalidObjectError] Failed to parse object (no:43,gen:0) -> [ArgumentError] wrong number of arguments (given 1, expected 0; required keyword: year)
I have no idea to move forward :'<
I also found the sign method of gem at https://github.com/gdelugre/origami/blob/master/lib/origami/signature.rb, and have take a look, I can't find any specific things to do :'<
Might this example is outdate?
The error message is known see https://github.com/gdelugre/origami/issues/80
A fix should be available https://github.com/gdelugre/origami/pull/74/commits
But has not been added so use newer file from the fork https://github.com/pocke/origami/tree/fix-ruby-2.7-kwargs-warnings
Specifically you need this updated file and may need to follow any other suggestions from above.
https://github.com/pocke/origami/raw/fix-ruby-2.7-kwargs-warnings/lib/origami/filters/predictors.rb
However it always worth looking for a fork with many more recent improvements such as
https://github.com/joelsondrew/origami

Rendering image using texSubImage2D in Haxe

I am learning how to stamp an image onto my canvas using Haxe and I have read that texSubImage2D should be the function I need to do the job.
I have read some documentation found here and thought I could implement what I was after by completing the following params:
void gl.texSubImage2D(target, level, xoffset, yoffset, format, type, HTMLImageElement? pixels);
This is what I did:
gl.texSubImage2D (cast fluid.dyeRenderTarget.writeToTexture, 0, Math.round(mouse.x), Math.round(mouse.y), gl.RGB, gl.UNSIGNED_BYTE, document.querySelector('img[src="images/myImage.jpg"]'));
However, when I try to build the project, I am getting the following errors:
src/Main.hx:571: characters 135-191 : js.html.Element should be Int
src/Main.hx:571: characters 135-191 : For function argument 'format'
When I went back to the docs, the format I have passed gl.RGB is an accepted param, so I am not sure where I am going wrong.
Any guidance would be really appreciated.
I can't quite reproduce the error message you're getting, I think the errors might have improved a bit in more in recent Haxe versions. Anyway, there's a few issues here:
Firstly, by doing gl.RGB / gl.UNSIGNED_BYTE, you're trying to access static fields from an instance. I actually get a helpful error for this:
Cannot access static field RGB from a class instance
While other languages allow this, Haxe does not, you have to access them through the class name. To fix this, simply prefix js.html.webgl.RenderingContext.
Secondly, querySelector() returns a plain js.html.Element, which none of the overloads accepts. They all want something more specific: VideoElement, ImageElement or CanvasElement. So you'd have to cast it first:
var image:js.html.ImageElement = cast document.querySelector('img[src="images/myImage.jpg"]');
Finally, it seems a bit suspicious that you'd need to cast the first parameter. Even if it works, there might be a nicer way of doing that with the wrapper you're using.
So in summary, the following should compile:
gl.texSubImage2D(cast fluid.dyeRenderTarget.writeToTexture, 0,
Math.round(mouse.x), Math.round(mouse.y),
RenderingContext.RGB, RenderingContext.UNSIGNED_BYTE, image);

Getting Error Array Type Required

I am trying to run this code:
RichViewEdit1.LineCount[i]:= Cipher.EncryptString(RichViewEdit1.LineCount[i]);
And I keep getting an error: Array Type Required.
Why I'm I getting this error?
More Info:
LineCount is - System.Integer
And TRichViewEdit does not have a "Lines" property.
Because RichViewEdit1.LineCount is not an array.
What it is ? don't know. Look into your sources, we cannot see them here.
PS. There seem to be no .Line*** properties at all: http://www.trichview.com/help/pme_cp_trichviewedit.html
Dunno if that still is relevant - http://www.trichview.com/support/trichview.support.examples/retrievingtext.htm
Also read through http://www.trichview.com/help/idh_rvgettext.html
PPS. since you paid for the component, you're entitled to get their programming examples and their customer support service. Both this and that are available at http://www.trichview.com/support/

Cannot get SURF example in EMGU.CV to work?

I am trying to detect a pattern shown in two images. Hence I have been trying to use the SURF algorithim found in emgu.CV, but the "SURFFeature" example that is given gives me the following error:
An unhandled exception of type 'Emgu.CV.Util.CvException' occurred in Emgu.CV.dll
Additional information: OpenCV: norm == NORM_L1 || norm == NORM_L2 || norm == NORM_HAMMING
Any ideas how to fix this?
When I try the "Hello World" example and the face detection example, both seem to work fine.
Thanks for any advice!
Fouad.
PS: Emgu.CV can be downloaded from here: http://www.emgu.com/wiki/index.php/Main_Page
Apparently the build was messed up.
http://www.emgu.com/bugs/show_bug.cgi?format=multiple&id=74
Aha, found it. The error here is in Emgu.Cv.Gpu/GpuBruteForceMatcher.cs lines 22 and 27.
Line 22 currently reads:
L2Dist,
It should read: L2Dist = 4,
Line 27 currently reads: HammingDist
It should read: HammingDist = 6
Rebuild the Emgu.CV.Gpu dll with those changes and it works.

Simple OpenCV problem

Why I try to run the following OpenCV program, it shows the following error :
ERROR:
test_1.exe - Application Error
The application failed to initialize properly (0x80000003).
Click on OK to terminate the application.
CODE:
#include "cv.h"
#include "highgui.h"
int main()
{
IplImage *img = cvLoadImage("C:\\face.bmp");
cvSetImageROI(img, cvRect(100,100, 100, 100));
cvAddS(img, cvScalar(50), img);
cvResetImageROI(img);
cvShowImage("Test", img);
cvWaitKey(0);
return 0;
}
When i press F5(im using vs2008express), the program encounters a break point...i have attached a picture...dont know, whether, it will help or not.
Error Snapshot Link
It is not that, only this program is producing this error, but also any kind of image manipulation funciton containing (OpenCV)program is resulting in this sitution.
Such as : cvSmooth
one last thing, it there any dedicated OpenCV forum or sth like that?
I am an administrator.So, yes, ive the permission.
a version mismatch.
sorry, i didn't get it?Version mismatch with what?
But, i have found the error using dependency walker.
Warning: At least one module has an unresolved import due to a missing export
function in a delay-load dependent module.
and also found that, it is a common problem, and found some info in the FAQ of DW...
Why am I seeing a lot of applications where MPR.DLL shows up in red under
SHLWAPI.DLL because it is missing a function named WNetRestoreConnectionA?
I also get a "Warning: At least one module has an unresolved import due to
a missing export function in a delay-load dependent module" message.
Function name : WNetRestoreConnectionA
But there is no guideline about how to solve it. Though, they say, it is not a problem.
i googled a little and found a suggestion.It says,
Turn off your compilers setting to assume you are programming for Win9x.
(I just lost which setting but it is not that difficult, use a #define...)
But i have no idea, how to do that in Visual Studio 2008 express.
Any suggestion how to solve it...
This usually indicates a problem with a dll; either you don't have permission, or a version is mismatched. Try running as Administrator to see if it is a permissions problem. If that doesn't help, try using the Dependency Walker.

Resources