[sane-devel] Code for writing bulk transfer

Jason Anderson sirius-c at iname.com
Sun Feb 15 22:48:57 GMT 2004


Sorry to bother you guys with questions. (-_-);;

I'm trying to do some bulk transfer with this little code I have.  The only trouble is that I've forgotten which commands to use when compiling it.  Could anyone of you please help me with it?  Wasn't the command "gcc -c foo.c"?  Also, to link with a library, shouldn't I do something like "gcc -c foo.c -lsane"?  Thank you in advance.

##################
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include "../include/sane/sane.h"
#include "../include/sane/config.h"
#include "../include/sane/sanei.h"
#include "../include/sane/sanei_usb.h"

/* Declare any prototypes */
SANE_Status status;
SANE_Int fd;

int main(void) {


/* Start up the usb_interface */
sanei_usb_init();

/* Try to access the usb device */
status = sanei_usb_open("/dev/usb/scanner0",&fd);

/* Check the status */
if (status == SANE_STATUS_GOOD) {
  printf("Okay, we have something.\n");
    }

/* Try to write something to the device*/
staus = sanei_usb_write_bulk(fd, 8, 8);

/*Try to see if we have bulk transfer */
if (status == SANE_STATUS_GOOD) {
    printf ("We have bulk transfer.\n");
                 }

/* Try to close the USB device */
sanei_usb_close(fd);
return 0;
}
##################
-- 
_______________________________________________
Get your free email from http://www.iname.com





More information about the sane-devel mailing list