implemented userspace reset utility
This commit is contained in:
parent
1175e8ab58
commit
99d99cba4e
Binary file not shown.
|
@ -16,7 +16,53 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../include/vendor-reset.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (argc < 4)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage:\n"
|
||||
" %s <domain> <bus> <devfn>\n",
|
||||
argv[0]
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int domain = atoi(argv[1]);
|
||||
int bus = atoi(argv[2]);
|
||||
int devfn = atoi(argv[3]);
|
||||
|
||||
int fd = open("/dev/vendor_reset", O_RDWR);
|
||||
if (fd < 0)
|
||||
{
|
||||
perror("open");
|
||||
return fd;
|
||||
}
|
||||
|
||||
struct vendor_reset_ioctl dev =
|
||||
{
|
||||
.domain = domain,
|
||||
.bus = bus,
|
||||
.devfn = devfn
|
||||
};
|
||||
|
||||
ret = ioctl(fd, VENDOR_RESET_RESET, &dev);
|
||||
if (ret < 0)
|
||||
{
|
||||
perror("ioctl");
|
||||
goto err;
|
||||
}
|
||||
|
||||
err:
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue