Add sample C program
This commit is contained in:
parent
f958c189d8
commit
b7969005eb
35
rpc/main.c
Normal file
35
rpc/main.c
Normal file
@ -0,0 +1,35 @@
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <sane/sane.h>
|
||||
|
||||
//gcc -lsane -L/usr/lib/arm-linux-gnueabihf/ -I/usr/include main.c
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
SANE_Status status;
|
||||
SANE_Int version_code;
|
||||
SANE_Auth_Callback authorize;
|
||||
SANE_Handle h;
|
||||
const SANE_Device **device_list;
|
||||
|
||||
status = sane_init(NULL, NULL);
|
||||
if(status != SANE_STATUS_GOOD) {
|
||||
perror("sane did not start");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
status = sane_get_devices(&device_list, SANE_TRUE);
|
||||
if(status != SANE_STATUS_GOOD) {
|
||||
perror("sane_get_devices, was apparently GOOD");
|
||||
}
|
||||
printf("%s, %s, %s, %s\n",
|
||||
device_list[0]->name,
|
||||
device_list[0]->vendor,
|
||||
device_list[0]->model,
|
||||
device_list[0]->type);
|
||||
|
||||
printf("exiting sane... \n");
|
||||
sane_exit();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user