Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _GNU_SOURCE
- #include <fcntl.h>
- #include <stdio.h>
- #include <sys/ioctl.h>
- #include <stdlib.h>
- #include "caller.h"
- int main(int argc, char **argv)
- {
- argVenDev arg2;
- int fd = -1;
- if (argc != 2 && argc != 3)
- {
- puts("Usage: ./caller [Function-number] or ./caller [Vendor] [Device]\n");
- return 1;
- }
- fd = open(DEVPATH, O_RDWR);
- if (fd < 0)
- {
- printf("Open device error: %m\n");
- return 1;
- }
- if(argc == 2)
- {
- int arg = atoi(argv[1]);
- int ret = ioctl(fd, IOCTL_GET_PSI_VENDEV, &arg);
- }
- else if(argc == 3)
- {
- arg2.vendor = atoi(argv[1]);
- arg2.device = atoi(argv[2]);
- int ret = ioctl(fd, IOCTL_GET_PSI_DEVFN, &arg2);
- }
- close(fd);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement