On Tue, 11 Jan 2005, Florian Echtler wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello Oliver! I'm quite open to your suggestions,
> but I'd like to know the reasoning behind..
>
> > + bytes_read +=
> > + snprintf (dev->bulk_in_buffer, dev->bulk_in_size, "%s", HEADER);
> > Use a copy operation.
> What kind of copy, memcpy()? And just for simplicity?
Yes. Handling strings is a matter of last resort.
> > + while (bytes_read < IMGSIZE) {
> > + result = usb_bulk_msg (dev->udev,
> > You should make this interruptible.
> How would this be done? And why do you think so?
Because you don't want frustrated users hitting ctrl-c and
nothing happens. Especially with an imperfectly understood
device.
> > + result = idmouse_create_image (dev);
> > Why on open()?
> Because it's the simplest solution, IMHO. That way, you can just use
> "cat" to get a fingerprint and don't have to know about any IOCTLs,
> just open the device, read the data and close it again.
The simplest way to do this is to issue the IO operation on
read if the buffer is empty. Now you are returning zero bytes
on a normal read(). That's a violation of POSIX.
Regards
Oliver
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel