xref: /OK3568_Linux_fs/external/rktoolkit/sample/sample_vendor_lib.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1  /*
2   * Copyright 2020 Fuzhou Rockchip Electronics Co., Ltd. All rights reserved.
3   * Use of this source code is governed by a BSD-style license that can be
4   * found in the LICENSE file.
5   */
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include <string.h>
9 #include "vendor_storage.h"
10 
main(int argc,char * argv[])11 int main(int argc, char *argv[])
12 {
13 	char data_0[128] = {0};
14 	char data_1[128] = {0};
15 
16 	rkvendor_read(VENDOR_SN_ID, data_0, sizeof(data_0)/sizeof(data_0[0]));
17 	fprintf(stderr, "DEMO-%d: read vendor sn: %s\n", __LINE__, data_0);
18 
19 	rkvendor_write(VENDOR_SN_ID, "DEMO-Serial No: 1234567890", strlen("DEMO-Serial No: 1234567890"));
20 	rkvendor_read(VENDOR_SN_ID, data_1, sizeof(data_1)/sizeof(data_1[0]));
21 	fprintf(stderr, "DEMO-%d: read vendor sn: %s\n", __LINE__, data_1);
22 
23 	rkvendor_write(VENDOR_SN_ID, data_0, sizeof(data_0)/sizeof(data_0[0]));
24 
25 	return EXIT_SUCCESS;
26 }
27