📄 vtp_test.c
字号:
/* * Copyright (C) 2004-2007 Christophe Jacquet <jacquetc@free.fr> * * See <vtplayer.c> and the associated documentation for more information. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include <stdlib.h>#include <stdio.h>#include "libvtplayer.h"int main(int argc, char **argv) { VTPLAYER vtp; unsigned int b1, b2, b3, b4; /* Four bytes */ int ret; if(argc != 5+1) { fprintf(stderr, "Expecting 5 arguments, but found %d instead.\n", argc); fprintf(stderr, "Usage: %s <device_node> <xx> <yy> <zz> <tt>\n", argv[0]); return EXIT_FAILURE; } if( sscanf(argv[2], "%x", &b1) != 1 || sscanf(argv[3], "%x", &b2) != 1 || sscanf(argv[4], "%x", &b3) != 1 || sscanf(argv[5], "%x", &b4) != 1) { fprintf(stderr, "Error: could not parse hexadecimal number!\n"); return EXIT_FAILURE; } if((vtp = vtplayer_open(argv[1])) != -1 ) { fprintf(stderr, "VTPlayer device opened: %s.\n", argv[1]); } else { fprintf(stderr, "Failed to open VTPlayer device '%s'.\n", argv[1]); return EXIT_FAILURE; } if((ret = vtplayer_set(vtp, b1, b2, b3, b4)) >= 0) { fprintf(stderr, "Pad configuration set.\n"); } else { fprintf(stderr, "Failed to sed pad configuration: %d\n", ret); return EXIT_FAILURE; } if((ret = vtplayer_close(vtp)) >= 0) { fprintf(stderr, "Device closed.\n"); } else { fprintf(stderr, "Failed to close device: %d.\n", ret); return EXIT_FAILURE; } return EXIT_SUCCESS;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -