代码拉取完成,页面将自动刷新
同步操作将从 liguang13579/Linux RC522 SPI S50 Read Card Device Drivers 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
* /linux-3.0.8/drivers/spi/rc522_test.c
*
*/
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <time.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include "rc522_test.h"
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
static const char *device = "/dev/rc522-1.0";
static uint8_t mode = SPI_MODE_0;
static uint8_t bits = 8;
static uint32_t speed = 500000;
static uint16_t delay;
static void pabort(const char *s){perror(s);abort();}
static void print_usage(const char *prog)
{
printf("Usage: %s [-DsbdlHOLC3]\n", prog);
puts(" -D --device device to use (default /dev/spidev1.1)\n"
" -s --speed max speed (Hz)\n"
" -d --delay delay (usec)\n"
" -b --bpw bits per word \n"
" -l --loop loopback\n"
" -H --cpha clock phase\n"
" -O --cpol clock polarity\n"
" -L --lsb least significant bit first\n"
" -C --cs-high chip select active high\n"
" -3 --3wire SI/SO signals shared\n");
exit(1);
}
static void parse_opts(int argc, char *argv[])
{
while (1) {
static const struct option lopts[] = {
{ "device", 1, 0, 'D' },
{ "speed", 1, 0, 's' },
{ "delay", 1, 0, 'd' },
{ "bpw", 1, 0, 'b' },
{ "loop", 0, 0, 'l' },
{ "cpha", 0, 0, 'H' },
{ "cpol", 0, 0, 'O' },
{ "lsb", 0, 0, 'L' },
{ "cs-high", 0, 0, 'C' },
{ "3wire", 0, 0, '3' },
{ "no-cs", 0, 0, 'N' },
{ "ready", 0, 0, 'R' },
{ NULL, 0, 0, 0 },
};
int c;
c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR", lopts, NULL);
if (c == -1)
break;
switch (c) {
case 'D':
device = optarg;
break;
case 's':
speed = atoi(optarg);
break;
case 'd':
delay = atoi(optarg);
break;
case 'b':
bits = atoi(optarg);
break;
case 'l':
mode |= SPI_LOOP;
break;
case 'H':
mode |= SPI_CPHA;
break;
case 'O':
mode |= SPI_CPOL;
break;
case 'L':
mode |= SPI_LSB_FIRST;
break;
case 'C':
mode |= SPI_CS_HIGH;
break;
case '3':
mode |= SPI_3WIRE;
break;
case 'N':
mode |= SPI_NO_CS;
break;
case 'R':
mode |= SPI_READY;
break;
default:
print_usage(argv[0]);
break;
}
}
}
/***** rc522 card ops *****/
static int rc522_operate_card(int fd,
struct rc522_ioc_transfer *xfer)
{
int ret = 0;
ret = ioctl(fd, SPI_IOC_MESSAGE(1), xfer);
if (ret == -1)
printf(" Y@_@Y (ioctl error) Y@_@Y\n");
return ret;
}
/***** rc522 read, write blk ops *****/
static int rc522_read_card(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
int i =0;
xfer->ioc_type = RC522_IOC_READ_CARD;
printf("/***** rc522 read card test: start *****/\n");
//for(sect = RC522_SECT_15; sect < RC522_SECT_15 + 1; sect++){
printf("read 0x%02x sector: start\n", xfer->sect_num);
//xfer->sect_num = sect;
//for(blk = RC522_BLK_0; blk < RC522_BLK_1; blk++){
printf("read 0x%02x blk: start", xfer->blk_num);
// xfer->blk_num = blk;
memset(xfer->txrx_buf, (__u8)0x00, CARD_BLK_SIZE + CARD_PLUS_SIZE);
if(rc522_operate_card(fd, xfer))
return 0;
for(i=0; i<CARD_BLK_SIZE; i++){
if(i%4 == 0) printf("\n");
printf("0x%02x ", xfer->txrx_buf[i]);
}
printf("\nread 0x%02x blk: end\n", xfer->blk_num);
//}
printf("read 0x%02x sector: end\n", xfer->sect_num);
//}
printf("/***** rc522 read card test: end *****/\n");
}
static int rc522_write_card(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
int i =0;
xfer->ioc_type = RC522_IOC_WRITE_CARD;
printf("/***** rc522 write card test: start *****/\n");
//for(sect = RC522_SECT_15; sect < RC522_SECT_15 + 1; sect++){
printf("write 0x%02x sector: start\n", xfer->sect_num);
//xfer->sect_num = sect;
//for(blk = RC522_BLK_0; blk < RC522_BLK_1; blk++){
printf("write 0x%02x blk: start", xfer->blk_num);
// xfer->blk_num = blk;
//memset(xfer->txrx_buf, (__u8)0x00,
// CARD_BLK_SIZE + CARD_PLUS_SIZE);
memset(xfer->txrx_buf, (__u8)(rand()%10),
CARD_BLK_SIZE);
/* write value: 0x00 */
if(rc522_operate_card(fd, xfer))
return 0;
for(i=0; i<CARD_BLK_SIZE; i++){
if(i%4 == 0) printf("\n");
printf("0x%02x ", xfer->txrx_buf[i]);
}
printf("\nwrite 0x%02x blk: end\n", xfer->blk_num);
//}
printf("write 0x%02x sector: end\n", xfer->sect_num);
//}
printf("/***** rc522 write card test: end *****/\n");
}
/***** rc522 inc, dec blk ops *****/
static int rc522_inc_card(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
int i =0;
xfer->ioc_type = RC522_IOC_INC_CARD;
printf("/***** rc522 inc card test: start *****/\n");
//for(sect = RC522_SECT_15; sect < RC522_SECT_15 + 1; sect++){
printf("inc 0x%02x sector: start\n", xfer->sect_num);
//xfer->sect_num = sect;
//for(blk = RC522_BLK_0; blk < RC522_BLK_1; blk++){
printf("inc 0x%02x blk: start", xfer->blk_num);
//xfer->blk_num = blk;
xfer->txrx_buf[0] = 0x00;
xfer->txrx_buf[1] = 0x00;
xfer->txrx_buf[2] = 0x00;
xfer->txrx_buf[3] = 0x00; /* inc value: 0x01 */
if(rc522_operate_card(fd, xfer))
return 0;
for(i=0; i<CARD_INC_SIZE; i++){
if(i%4 == 0) printf("\n");
printf("0x%02x ", xfer->txrx_buf[i]);
}
printf("\ninc 0x%02x blk: end\n", xfer->blk_num);
//}
printf("inc 0x%02x sector: end\n", xfer->sect_num);
//}
printf("/***** rc522 inc card test: end *****/\n");
}
static int rc522_dec_card(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
int i =0;
xfer->ioc_type = RC522_IOC_DEC_CARD;
printf("/***** rc522 dec card test: start *****/\n");
//for(sect = RC522_SECT_15; sect < RC522_SECT_15 + 1; sect++){
printf("dec 0x%02x sector: start\n", xfer->sect_num);
//xfer->sect_num = sect;
//for(blk = RC522_BLK_0; blk < RC522_BLK_1; blk++){
printf("dec 0x%02x blk: start", xfer->blk_num);
// xfer->blk_num = blk;
xfer->txrx_buf[0] = 0x01;
xfer->txrx_buf[1] = 0x00;
xfer->txrx_buf[2] = 0x00;
xfer->txrx_buf[3] = 0x00; /* inc value: 0x01 */
if(rc522_operate_card(fd, xfer))
return 0;
for(i=0; i<CARD_INC_SIZE; i++){
if(i%4 == 0) printf("\n");
printf("0x%02x ", xfer->txrx_buf[i]);
}
printf("\ndec 0x%02x blk: end\n", xfer->blk_num);
//}
printf("dec 0x%02x sector: end\n", xfer->sect_num);
//}
printf("/***** rc522 dec card test: end *****/\n");
}
/***** rc522 key area ops *****/
static int rc522_read_keya(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
int i =0;
xfer->ioc_type = RC522_IOC_READ_KEYA;
printf("/***** rc522 read keya test: start *****/\n");
//for(; sect < RC522_SECT_15 + 1; sect++){
printf("read 0x%02x sector keya: start\n", xfer->sect_num);
//xfer->sect_num = sect;
memset(xfer->txrx_buf, (__u8)0x00,
CARD_BLK_SIZE + CARD_PLUS_SIZE);
if(rc522_operate_card(fd, xfer))
return 0;
for(i=0; i<CARD_KEYA_SIZE; i++){
if(i%4 == 0) printf("\n");
printf("0x%02x ", xfer->txrx_buf[i]);
}
printf("\nread 0x%02x sector keya: end\n\n", xfer->sect_num);
//}
printf("/***** rc522 read keya test: end *****/\n");
}
static int rc522_read_keyb(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
int i =0;
xfer->ioc_type = RC522_IOC_READ_KEYB;
printf("/***** rc522 read keyb test: start *****/\n");
//for(sect = RC522_SECT_15; sect < RC522_SECT_15 + 1; sect++){
printf("read 0x%02x sector keyb: start\n", xfer->sect_num);
//xfer->sect_num = sect;
memset(xfer->txrx_buf, (__u8)0x00,
CARD_BLK_SIZE + CARD_PLUS_SIZE);
if(rc522_operate_card(fd, xfer))
return 0;
for(i=0; i<CARD_KEYA_SIZE; i++){
if(i%4 == 0) printf("\n");
printf("0x%02x ", xfer->txrx_buf[i]);
}
printf("\nread 0x%02x sector keyb: end\n", xfer->sect_num);
//}
printf("/***** rc522 read keyb test: end *****/\n");
}
static int rc522_read_ctrl(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
int i =0;
xfer->ioc_type = RC522_IOC_READ_CTRL;
printf("/***** rc522 read ctrl test: start *****/\n");
//for(sect = RC522_SECT_15; sect < RC522_SECT_15 + 1; sect++){
printf("read 0x%02x sector ctrl: start\n", xfer->sect_num);
// xfer->sect_num = sect;
memset(xfer->txrx_buf, (__u8)0x00, CARD_BLK_SIZE+CARD_PLUS_SIZE);
if(rc522_operate_card(fd, xfer))
return 0;
for(i=0; i<CARD_CTRL_SIZE; i++){
printf("0x%02x ", xfer->txrx_buf[i]);
}
printf("\nread 0x%02x sector ctrl: end\n", xfer->sect_num);
//}
printf("/***** rc522 read ctrl test: end *****/\n");
}
static int rc522_write_keya(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
unsigned char rand_key = (__u8)(rand()/2);
int i =0;
xfer->ioc_type = RC522_IOC_WRITE_KEYA;
printf("/***** rc522 write keya test: start *****/\n");
//for(sect = RC522_SECT_15; sect < RC522_SECT_15 + 1; sect++){
printf("write 0x%02x sector keya: start\n", xfer->sect_num);
//xfer->sect_num = sect;
//memset(xfer->txrx_buf, rand_key, CARD_KEYA_SIZE);
//memset(xfer->keya_buf, rand_key, CARD_KEYA_SIZE);
xfer->txrx_buf[0] = (__u8)0xff;
xfer->txrx_buf[1] = (__u8)0xff;
xfer->txrx_buf[2] = (__u8)0xff;
xfer->txrx_buf[3] = (__u8)0xff;
xfer->txrx_buf[4] = (__u8)0xff;
xfer->txrx_buf[5] = (__u8)0xff;
if(rc522_operate_card(fd, xfer))
return 0;
for(i=0; i<CARD_KEYA_SIZE; i++){
printf("0x%02x ", xfer->txrx_buf[i]);
}
printf("\nwrite 0x%02x sector keya: end\n", xfer->sect_num);
//}
printf("/***** rc522 write keya test: end *****/\n");
}
static int rc522_write_keyb(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
unsigned char rand_key = (__u8)(rand()/2);
int i =0;
xfer->ioc_type = RC522_IOC_WRITE_KEYB;
printf("/***** rc522 write keyb test: start *****/\n");
//for(sect = RC522_SECT_15; sect < RC522_SECT_15 + 1; sect++){
printf("write 0x%02x sector keyb: start\n", xfer->sect_num);
//xfer->sect_num = sect;
xfer->txrx_buf[0] = (__u8)0xff;
xfer->txrx_buf[1] = (__u8)0xff;
xfer->txrx_buf[2] = (__u8)0xff;
xfer->txrx_buf[3] = (__u8)0xff;
xfer->txrx_buf[4] = (__u8)0xff;
xfer->txrx_buf[5] = (__u8)0xff;
if(rc522_operate_card(fd, xfer))
return 0;
for(i=0; i<CARD_KEYB_SIZE; i++){
printf("0x%02x ", xfer->txrx_buf[i]);
}
printf("\nwrite 0x%02x sector keyb: end\n", xfer->sect_num);
//}
printf("/***** rc522 write keyb test: end *****/\n");
return 0;
}
static int rc522_write_ctrl(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
int i =0;
xfer->ioc_type = RC522_IOC_WRITE_CTRL;
printf("rc522 write ctrl test: start *****/\n");
//for(sect = RC522_SECT_15; sect < RC522_SECT_15 + 1; sect++){
printf("write 0x%02x sector ctrl: start\n", xfer->sect_num);
// xfer->sect_num = sect;
xfer->txrx_buf[0] = (__u8)0xff; /* using default value*/
xfer->txrx_buf[1] = (__u8)0x07; /* using default value*/
xfer->txrx_buf[2] = (__u8)0x80; /* using default value*/
xfer->txrx_buf[3] = (__u8)0x69; /* using default value*/
if(rc522_operate_card(fd, xfer))
return 0;
for(i=0; i<CARD_CTRL_SIZE; i++){
printf("0x%02x ", xfer->txrx_buf[i]);
}
printf("\nwrite 0x%02x sector ctrl: end\n", xfer->sect_num);
//}
printf("/***** rc522 write ctrl test: end *****/\n");
}
/***** critical ops: the user can have all permission for protected sector(0-9) *****/
static int rc522_unlock_low_sect(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
int i =0;
//xfer->ioc_type = RC522_IOC_WRITE_KEYA; //xfer->sect_num = RC522_SECT_9;
xfer->sect_lock = RC522_SECT_UNLOCK;
printf("/***** rc522 unlock low sect test: start *****/\n");
printf("unlock 0x%02x sector: start\n", xfer->sect_num);
printf("%s: \n%s \nfor %s\n",
xfer->sect_lock == RC522_SECT_UNLOCK ?
"unlock low sector(0-9) mode" :
"lock low sector(0-9) mode",
xfer->sect_lock == RC522_SECT_UNLOCK ?
"the user have all permission to write ctrl blk(3)" :
"the user have non permission to write ctrl blk(3)",
xfer->sect_lock == RC522_SECT_UNLOCK ?
"all sector(0-15)" :
"low sector(0-9)");
}
static int rc522_lock_low_sect(int fd,
struct rc522_ioc_transfer *xfer)
{
enum rc522_sect_num sect = 0;
enum rc522_blk_num blk = 0;
unsigned char rand_key = (__u8)(rand()/2);
int i =0;
//xfer->ioc_type = RC522_IOC_WRITE_KEYA; //xfer->sect_num = RC522_SECT_15;
xfer->sect_lock = RC522_SECT_LOCK;
printf("unlock 0x%02x sector: end\n", xfer->sect_num);
printf("/***** rc522 unlock low sect test: end *****/\n");
printf("%s: \n%s \nfor %s\n",
xfer->sect_lock == RC522_SECT_UNLOCK ?
"unlock low sector(0-9) mode" :
"lock low sector(0-9) mode",
xfer->sect_lock == RC522_SECT_UNLOCK ?
"the user have all permission to write ctrl blk(3)" :
"the user have non permission to write ctrl blk(3)",
xfer->sect_lock == RC522_SECT_UNLOCK ?
"all sector(0-15)" :
"low sector(0-9)");
}
static int rc522_goto_menu(int fd,
struct rc522_ioc_transfer *xfer)
{
return 0;
//}
}
struct {
void (*function)(int fd, struct rc522_ioc_transfer *xfer);
char *msg;
}ioc_type_menu[] = {
{ rc522_goto_menu, "rc522 goto before menu: \n" } ,
{ rc522_read_card, "rc522 read card test: \n" } ,
{ rc522_write_card, "rc522 write card test: \n\n" } ,
//{ rc522_inc_card, "rc522 increase card test: \n" } ,
//{ rc522_dec_card, "rc522 decrease card test: \n\n" } ,
{ rc522_read_keya, "rc522 read keya test: \n" } ,
{ rc522_read_keyb, "rc522 read keyb test: \n" } ,
{ rc522_read_ctrl, "rc522 read ctrl area: \n\n" } ,
{ rc522_write_keya, "rc522 write keya test: \n" } ,
{ rc522_write_keyb, "rc522 write keyb test: \n" } ,
{ rc522_write_ctrl, "rc522 write ctrl area: \n\n" } ,
{ rc522_lock_low_sect, "rc522 lock low sect test: \n" } ,
{ rc522_unlock_low_sect,"rc522 unlock low sect test: \n" } ,
{ 0, 0}
};
static int rc522_menu_card(int fd,
struct rc522_ioc_transfer *xfer)
{
int i =0;
int select_index = 0;
__u32 select_sect = 0;
while(1){
xfer->sect_lock = RC522_SECT_LOCK;
printf("RC522 Test Card Menu:\n");
printf("%s: \n%s \nfor %s\n",
xfer->sect_lock == RC522_SECT_UNLOCK ?
"unlock low sector(0-9) mode" :
"lock low sector(0-9) mode",
xfer->sect_lock == RC522_SECT_UNLOCK ?
"the user have all permission to write ctrl blk(3)" :
"the user have non permission to write ctrl blk(3)",
xfer->sect_lock == RC522_SECT_UNLOCK ?
"all sector(0-15)" :
"low sector(0-9)");
printf("\nPlease input the sect number(0-15):");
scanf("%u", &select_sect);
if(select_sect < 0 || select_sect > 15){
printf("\nYou select unused sect: %d", select_sect);
continue;
}
xfer->sect_num = (__u8)select_sect;
printf("You select sect: %u\n", xfer->sect_num);
while(1)
{
printf("\nPlease select function: \n");
for(i=0; ioc_type_menu[i].function!=0; i++)
printf("%d : %s", i, ioc_type_menu[i].msg);
printf("\nPlease input the select number:");
scanf("%d", &select_index) ;
printf("You select %d function: %s\n",
select_index, ioc_type_menu[select_index].msg);
//getchar();
if(0 < select_index && select_index < i)
{
(*ioc_type_menu[select_index].function)(fd, xfer);
sleep(1);
}else{
break;
}
//printf("\nPlease enter key to contine:\n");
//getchar();
}
}
printf("Do not goto here\n");
return i;
}
int main(int argc, char *argv[])
{
int ret = 0;
int fd = -1;
int i = 0;
parse_opts(argc, argv);
fd = open(device, O_RDWR);
if (fd < 0)
pabort("can't open device");
/***** RC522 Test
****** the key a have all permission ,
****** the key b have non permission ,
****** when ctrl area using default value .
*****/
struct rc522_ioc_transfer transfer={
.ioc_type = RC522_IOC_REQ_CARD,
.blk_num = RC522_BLK_0,
};
transfer.key_type = RC522_KEY_A;
//transfer.key_type = RC522_KEY_B;
//transfer.key_type = RC522_KEY_A_B;
//transfer.keya_buf[0] = 0; transfer.keya_buf[1] = 0;
//transfer.keya_buf[2] = 0; transfer.keya_buf[3] = 0;
//transfer.keya_buf[4] = 0; transfer.keya_buf[5] = 0;
transfer.keya_buf[0] = 0xff; transfer.keya_buf[1] = 0xff;
transfer.keya_buf[2] = 0xff; transfer.keya_buf[3] = 0xff;
transfer.keya_buf[4] = 0xff; transfer.keya_buf[5] = 0xff;
//transfer.keyb_buf[0] = 1; transfer.keyb_buf[1] = 1;
//transfer.keyb_buf[2] = 1; transfer.keyb_buf[3] = 1;
//transfer.keyb_buf[4] = 1; transfer.keyb_buf[5] = 1;
transfer.keyb_buf[0] = 0xff; transfer.keyb_buf[1] = 0xff;
transfer.keyb_buf[2] = 0xff; transfer.keyb_buf[3] = 0xff;
transfer.keyb_buf[4] = 0xff; transfer.keyb_buf[5] = 0xff;
memset(transfer.txrx_buf, 0x00, CARD_BLK_SIZE + CARD_PLUS_SIZE);
i = 10;
while(i){
if(rc522_operate_card(fd, &transfer)){
printf("Please put your card on readed pad:");
i--;
sleep(1);
continue;
}
break;
}
if(i == 0){
printf(" Failed to find your card on readed pad:\n");
close(fd);
return 0;
}
printf("Request Card: \n");
printf("type: 0x%02x, 0x%02x, %s \n",
transfer.txrx_buf[0],transfer.txrx_buf[1],
transfer.txrx_buf[0] == 0x04?"S50 card":
(transfer.txrx_buf[0] == 0x02?"S70 card":"Other card"));
printf("id: 0x%02x, 0x%02x, 0x%02x, 0x%02x, idcsum: 0x%02x\n",
transfer.txrx_buf[2], transfer.txrx_buf[3],
transfer.txrx_buf[4], transfer.txrx_buf[5],
transfer.txrx_buf[6]);
printf("id_buf: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
transfer.id_buf[0], transfer.id_buf[1],
transfer.id_buf[2], transfer.id_buf[3]);
printf("cap: 0x%02x Kbits, msg: 0x%02x, 0x%02x\n",
transfer.txrx_buf[7], transfer.txrx_buf[8],transfer.txrx_buf[9]);
printf("Request Card: end\n\n");
if(transfer.txrx_buf[0] == 0x00){
printf("Failed to request used card: %s\n","Unused card");
return 0;
}
rc522_menu_card(fd, &transfer);
/*
printf("SPI interface mode: \n");
ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
if (ret == -1)
pabort("can't set spi mode");
ret = ioctl(fd, SPI_IOC_RD_MODE, &mode);
if (ret == -1)
pabort("can't get spi mode");
ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
if (ret == -1)
pabort("can't set bits per word");
ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
if (ret == -1)
pabort("can't get bits per word");
ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed);
if (ret == -1)
pabort("can't set max speed hz");
ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed);
if (ret == -1)
pabort("can't get max speed hz");
printf("spi mode: %d\n", mode);
printf("bits per word: %d\n", bits);
printf("max speed: %d Hz (%d KHz)\n\n\n", speed, speed/1000);
*/
close(fd);
return ret;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。