From b7969005eb3ac8766a1682cdf5ee1beb70bd026d Mon Sep 17 00:00:00 2001 From: Maks Snegov Date: Mon, 11 May 2020 22:04:35 +0300 Subject: [PATCH] Add sample C program --- rpc/main.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 rpc/main.c diff --git a/rpc/main.c b/rpc/main.c new file mode 100644 index 0000000..9d2dfbc --- /dev/null +++ b/rpc/main.c @@ -0,0 +1,35 @@ +#include +#include +#include +#include +#include + +//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); +}