1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#include <stdio.h> 17#include <string.h> 18#include "hdf_base.h" 19#include "hdf_log.h" 20#include "usb_dev_test.h" 21 22#define OPTION_LENGTH 2 23 24static void ShowUsage(void) 25{ 26 printf("Usage options:\n"); 27 printf("-1 : AcmRead\n"); 28 printf("-2 : AcmWrite\n"); 29 printf("-3 : AcmTest\n"); 30 printf("-4 : PropTest\n"); 31 printf("-5 : AcmSpeedRead\n"); 32 printf("-6 : AcmSpeedWrite\n"); 33 printf("-h : show usage\n"); 34} 35 36int32_t main(int32_t argc, char *argv[]) 37{ 38 if (argc < OPTION_LENGTH) { 39 printf("argv too flew\n"); 40 HDF_LOGE("%{public}s:%{public}d argc=%{public}d is too flew!", __func__, __LINE__, argc); 41 return -1; 42 } 43 const char **arg = (const char **)&argv[1]; 44 if (strcmp(arg[0], "-1") == 0) { 45 AcmRead(argc - 1, arg); 46 } else if (strcmp(arg[0], "-2") == 0) { 47 AcmWrite(argc - 1, arg); 48 } else if (strcmp(arg[0], "-3") == 0) { 49 AcmTest(argc - 1, arg); 50 } else if (strcmp(arg[0], "-4") == 0) { 51 PropTest(argc - 1, arg); 52 } else if (strcmp(arg[0], "-5") == 0) { 53 AcmSpeedRead(argc - 1, arg); 54 } else if (strcmp(arg[0], "-6") == 0) { 55 AcmSpeedWrite(argc - 1, arg); 56 } else if (strcmp(arg[0], "-h") == 0 || \ 57 strcmp(arg[0], "?") == 0) { 58 ShowUsage(); 59 } else { 60 printf("unknown cmd\n"); 61 } 62 return 0; 63} 64