Proposal for changes to interface.h

sbertin@mindspring.com sbertin@mindspring.com
Thu, 9 Sep 1999 02:09:08 -0400 (EDT)


Here is a proposal for changes to interface.h.  For each function I've
listed a prototype, a description of what is changed, and a description
of how it should be used.  I think this will provide a cleaner
separation between the hardware access and the code that interfaces
with the program.  I'm interested in any feedback anyone has,
particularly anybody working on the USB driver.

I view this as a step toward what the final driver will look like (see
my Future direction of driver e-mail), and it will probably change at
least once more before this driver becomes part of the kernel.

Scott J. Bertin
sbertin@mindspring.com

- All pointer should point to memory in kernel space, not user space.

int if_Init(char *str, int *ints);
- No change from current

int if_Open(int minor, void **privdata, void (*cb)(void *cbdata), void *cbdata);
- Sets file->private_data (or equivalent) to point to structure for this
camera.  This is then used in the following functions instead of the
minor number.  This is a cleaner implementation for when the driver
supports arbitrary minor numbers.
- Registers callback function cb to be called with cbdata when an image is ready
while streaming.  If cb is NULL, only single image grabs are allowed.
cb should immediately call if_StreamRead to read the data or data may be lost.
- Returns negative value on error, otherwise 0.

int if_TransferMsg(void *privdata, u8 *command, u8 *data);
- privdata instead of minor number
- ioctl handling is moved higher up in the driver, this just sends messages
to the camera.  command MUST be 8 bytes.  If no extra data is needed,
then data can be NULL.  The size of data and its read/write status can
be determined from command.
- Returns negative value on error, otherwise 0.

int if_StreamRead (void *privdata, u8 *frame);
- privdata instead of minor number
- frame should be a buffer of MAX_IMAGE_SIZE bytes.  The driver higher up is
responsible for handling partial reads.  Right now I think data will be
lost on a partial read.  Ideally, this would be buffered by the higher level
driver until the programs asks for it.
- Returns the number of bytes read, or negative value on error.

int if_Close(void *privdata);
- privdata instead of minor number

void if_Cleanup(void);
- return type changed to void


-----------------------------------------------------------------------------
To unsubscribe from this mailinglist, send the line "unsubscribe vision-webcam" in the
body of a message to "majordomo@errors.no".