mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2025-04-21 12:27:27 +03:00
Moved fw/ and tools/ into atrf/ as well.
- fw/: moved to atrf/fw/ - tools/: moved to atrf/tools/ - atrf/fw/atspi/Makefile, atrf/fw/boot/Makefile: updated relative path to f32xbase - atrf/tools/Makefile: updated relative path to Makefile.recurse - atrf/tools/atspi-id/Makefile, atrf/tools/atspi-reset/Makefile, atrf/tools/atspi-rssi/Makefile, atrf/tools/lib/Makefile: updated relative path to f32xbase - atrf/fw/include/at86rf230.h: corrected path in title - atrf/tools/include/atspi.h: added title and copyright header
This commit is contained in:
16
atrf/tools/Makefile
Normal file
16
atrf/tools/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# tools/Makefile - Build the ATSPI-specific tools
|
||||
#
|
||||
# Written 2010 by Werner Almesberger
|
||||
# Copyright 2010 Werner Almesberger
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
DIRS=atspi-id atspi-reset atspi-rssi
|
||||
|
||||
include ../../Makefile.recurse
|
||||
21
atrf/tools/atspi-id/Makefile
Normal file
21
atrf/tools/atspi-id/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# atspi-id/Makefile - Build the ATSPI identification utility
|
||||
#
|
||||
# Written 2010 by Werner Almesberger
|
||||
# Copyright 2010 Werner Almesberger
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
F32XBASE = ../../../../f32xbase
|
||||
|
||||
MAIN = atspi-id
|
||||
|
||||
include $(F32XBASE)/lib/Makefile.common
|
||||
|
||||
CFLAGS += -I../../fw/include -I../include
|
||||
LDLIBS += -L../lib -latspi
|
||||
120
atrf/tools/atspi-id/atspi-id.c
Normal file
120
atrf/tools/atspi-id/atspi-id.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* atspi-id/atspi-id.c - Identify a ben-wpan AF86RF230 board
|
||||
*
|
||||
* Written 2010 by Werner Almesberger
|
||||
* Copyright 2010 Werner Almesberger
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <usb.h>
|
||||
|
||||
#include "at86rf230.h"
|
||||
#include "atspi/ep0.h"
|
||||
#include "atspi.h"
|
||||
|
||||
|
||||
#define FROM_DEV ATSPI_FROM_DEV(0)
|
||||
|
||||
#define BUF_SIZE 256
|
||||
|
||||
|
||||
|
||||
static int get_id(usb_dev_handle *dev, void *data, int size)
|
||||
{
|
||||
int res;
|
||||
|
||||
res = usb_control_msg(dev, FROM_DEV, ATSPI_ID, 0, 0, data, size, 1000);
|
||||
if (res < 0)
|
||||
fprintf(stderr, "ATSPI_ID: %s\n", usb_strerror());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static int atspi_get_protocol(usb_dev_handle *dev,
|
||||
uint8_t *major, uint8_t *minor, uint8_t *target)
|
||||
{
|
||||
uint8_t ids[3];
|
||||
|
||||
if (get_id(dev, ids, 3) < 0)
|
||||
return -1;
|
||||
if (major)
|
||||
*major = ids[0];
|
||||
if (minor)
|
||||
*minor = ids[1];
|
||||
if (target)
|
||||
*target = ids[2];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int atspi_get_build(usb_dev_handle *dev, char *buf, size_t size)
|
||||
{
|
||||
int res;
|
||||
|
||||
res = usb_control_msg(dev, FROM_DEV, ATSPI_BUILD, 0, 0, buf, size,
|
||||
1000);
|
||||
if (res < 0)
|
||||
fprintf(stderr, "ATSPI_BUILD: %s\n", usb_strerror());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static void show_info(usb_dev_handle *dev)
|
||||
{
|
||||
const struct usb_device *device = usb_device(dev);
|
||||
uint8_t major, minor, target;
|
||||
char buf[BUF_SIZE+1]; /* +1 for terminating \0 */
|
||||
int len;
|
||||
uint8_t part, version, man_id_0, man_id_1;
|
||||
|
||||
printf("%04x:%04x ",
|
||||
device->descriptor.idVendor, device->descriptor.idProduct);
|
||||
|
||||
if (atspi_get_protocol(dev, &major, &minor, &target) < 0)
|
||||
exit(1);
|
||||
printf("protocol %u.%u hw %u\n", major, minor, target);
|
||||
|
||||
len = atspi_get_build(dev, buf, sizeof(buf)-1);
|
||||
if (len < 0)
|
||||
exit(1);
|
||||
buf[len] = 0;
|
||||
printf("%10s%s\n", "", buf);
|
||||
|
||||
part = atspi_reg_read(dev, REG_PART_NUM);
|
||||
version = atspi_reg_read(dev, REG_VERSION_NUM);
|
||||
man_id_0 = atspi_reg_read(dev, REG_MAN_ID_0);
|
||||
man_id_1 = atspi_reg_read(dev, REG_MAN_ID_1);
|
||||
printf("%10spart 0x%02x version %u manufacturer xxxx%02x%02x\n", "",
|
||||
part, version, man_id_1, man_id_0);
|
||||
}
|
||||
|
||||
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr, "%s\n", name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
usb_dev_handle *dev;
|
||||
|
||||
if (argc != 1)
|
||||
usage(*argv);
|
||||
dev = atspi_open();
|
||||
if (!dev)
|
||||
return 1;
|
||||
|
||||
show_info(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
21
atrf/tools/atspi-reset/Makefile
Normal file
21
atrf/tools/atspi-reset/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# atspi-reset/Makefile - Reset the transceiver or the whole board
|
||||
#
|
||||
# Written 2010 by Werner Almesberger
|
||||
# Copyright 2010 Werner Almesberger
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
F32XBASE = ../../../../f32xbase
|
||||
|
||||
MAIN = atspi-reset
|
||||
|
||||
include $(F32XBASE)/lib/Makefile.common
|
||||
|
||||
CFLAGS += -I../../fw/include -I../include
|
||||
LDLIBS += -L../lib -latspi
|
||||
62
atrf/tools/atspi-reset/atspi-reset.c
Normal file
62
atrf/tools/atspi-reset/atspi-reset.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* atspi-rssi/atspi-rssi.c - ben-wpan AF86RF230 spectrum scan
|
||||
*
|
||||
* Written 2010 by Werner Almesberger
|
||||
* Copyright 2010 Werner Almesberger
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <usb.h>
|
||||
|
||||
#include "atspi.h"
|
||||
|
||||
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [-a|-t]\n\n"
|
||||
" -a reset the MCU and transceiver\n"
|
||||
" -t reset transceiver (default)\n"
|
||||
, name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
usb_dev_handle *dev;
|
||||
int txrx = 1;
|
||||
|
||||
switch (argc) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
if (!strcmp(argv[1], "-t"))
|
||||
break;
|
||||
txrx = 0;
|
||||
if (!strcmp(argv[1], "-a"))
|
||||
break;
|
||||
/* fall through */
|
||||
default:
|
||||
usage(*argv);
|
||||
}
|
||||
|
||||
dev = atspi_open();
|
||||
if (!dev)
|
||||
return 1;
|
||||
|
||||
if (txrx)
|
||||
atspi_reset_rf(dev);
|
||||
else
|
||||
atspi_reset(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
21
atrf/tools/atspi-rssi/Makefile
Normal file
21
atrf/tools/atspi-rssi/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# atspi-rssi/Makefile - Build the spectrum scan utility
|
||||
#
|
||||
# Written 2010 by Werner Almesberger
|
||||
# Copyright 2010 Werner Almesberger
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
F32XBASE = ../../../../f32xbase
|
||||
|
||||
MAIN = atspi-rssi
|
||||
|
||||
include $(F32XBASE)/lib/Makefile.common
|
||||
|
||||
CFLAGS += -I../../fw/include -I../include
|
||||
LDLIBS += -L../lib -latspi
|
||||
92
atrf/tools/atspi-rssi/atspi-rssi.c
Normal file
92
atrf/tools/atspi-rssi/atspi-rssi.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* atspi-rssi/atspi-rssi.c - ben-wpan AF86RF230 spectrum scan
|
||||
*
|
||||
* Written 2010 by Werner Almesberger
|
||||
* Copyright 2010 Werner Almesberger
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <usb.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "at86rf230.h"
|
||||
#include "atspi/ep0.h"
|
||||
#include "atspi.h"
|
||||
|
||||
|
||||
#define FROM_DEV ATSPI_FROM_DEV(0)
|
||||
#define TO_DEV ATSPI_TO_DEV(0)
|
||||
|
||||
|
||||
static struct timeval t0;
|
||||
|
||||
|
||||
static void sweep(usb_dev_handle *dev)
|
||||
{
|
||||
int chan, rssi;
|
||||
struct timeval t;
|
||||
|
||||
for (chan = 11; chan <= 26; chan++) {
|
||||
atspi_reg_write(dev, REG_PHY_CC_CCA, chan);
|
||||
/*
|
||||
* No need to explicitly wait for the PPL lock - going USB-SPI
|
||||
* is pretty slow, leaving the transceiver plenty of time.
|
||||
*/
|
||||
gettimeofday(&t, NULL);
|
||||
rssi = atspi_reg_read(dev, REG_PHY_RSSI) & RSSI_MASK;
|
||||
t.tv_sec -= t0.tv_sec;
|
||||
t.tv_usec -= t0.tv_usec;
|
||||
printf("%d %f %d\n",
|
||||
2405+(chan-11)*5,
|
||||
(double) t.tv_sec+t.tv_usec/1000000.0,
|
||||
-91+3*(rssi-1));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr, "%s sweeps \n", name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
usb_dev_handle *dev;
|
||||
unsigned long sweeps, i;
|
||||
char *end;
|
||||
|
||||
if (argc != 2)
|
||||
usage(*argv);
|
||||
sweeps = strtoul(argv[1], &end, 0);
|
||||
if (*end)
|
||||
usage(*argv);
|
||||
|
||||
dev = atspi_open();
|
||||
if (!dev)
|
||||
return 1;
|
||||
|
||||
atspi_reg_write(dev, REG_TRX_STATE, TRX_CMD_TRX_OFF);
|
||||
/*
|
||||
* No need to explicitly wait for things to stabilize - going USB-SPI
|
||||
* is pretty slow, leaving the transceiver more than enough time.
|
||||
*/
|
||||
atspi_reg_write(dev, REG_TRX_STATE, TRX_CMD_RX_ON);
|
||||
|
||||
gettimeofday(&t0, NULL);
|
||||
for (i = 0; i != sweeps; i++)
|
||||
sweep(dev);
|
||||
|
||||
atspi_reg_write(dev, REG_TRX_STATE, TRX_CMD_TRX_OFF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
21
atrf/tools/atspi-txrx/Makefile
Normal file
21
atrf/tools/atspi-txrx/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# atspi-txrx/Makefile - Build the TX/RX test utility
|
||||
#
|
||||
# Written 2010 by Werner Almesberger
|
||||
# Copyright 2010 Werner Almesberger
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
F32XBASE = ../../../f32xbase
|
||||
|
||||
MAIN = atspi-txrx
|
||||
|
||||
include $(F32XBASE)/lib/Makefile.common
|
||||
|
||||
CFLAGS += -I../../fw/include -I../include
|
||||
LDLIBS += -L../lib -latspi
|
||||
50
atrf/tools/atspi-txrx/atspi-txrx.c
Normal file
50
atrf/tools/atspi-txrx/atspi-txrx.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* atspi-txrx/atspi-txrx.c - ben-wpan AF86RF230 TX/RX
|
||||
*
|
||||
* Written 2010 by Werner Almesberger
|
||||
* Copyright 2010 Werner Almesberger
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <usb.h>
|
||||
|
||||
#include "at86rf230.h"
|
||||
#include "atspi/ep0.h"
|
||||
#include "atspi.h"
|
||||
|
||||
|
||||
#define FROM_DEV ATSPI_FROM_DEV(0)
|
||||
#define TO_DEV ATSPI_TO_DEV(0)
|
||||
|
||||
#define BUF_SIZE 256
|
||||
|
||||
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr, "%s\n", name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
usb_dev_handle *dev;
|
||||
|
||||
if (argc != 1)
|
||||
usage(*argv);
|
||||
dev = atspi_open();
|
||||
if (!dev)
|
||||
return 1;
|
||||
|
||||
atspi_reg_write(dev, REG_TRX_STATE, TRX_CMD_TRX_OFF);
|
||||
sleep(1000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
32
atrf/tools/include/atspi.h
Normal file
32
atrf/tools/include/atspi.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* include/atspi.h - ATSPI access functions library
|
||||
*
|
||||
* Written 2010 by Werner Almesberger
|
||||
* Copyright 2010 Werner Almesberger
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ATSPI_H
|
||||
#define ATSPI_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <usb.h>
|
||||
|
||||
|
||||
int atspi_error(void);
|
||||
int atspi_clear_error(void);
|
||||
|
||||
usb_dev_handle *atspi_open(void);
|
||||
void atspi_close(usb_dev_handle *dev);
|
||||
|
||||
void atspi_reset(usb_dev_handle *dev);
|
||||
void atspi_reset_rf(usb_dev_handle *dev);
|
||||
|
||||
void atspi_reg_write(usb_dev_handle *dev, uint8_t reg, uint8_t value);
|
||||
uint8_t atspi_reg_read(usb_dev_handle *dev, uint8_t reg);
|
||||
|
||||
#endif /* !ATSPI_H */
|
||||
32
atrf/tools/lib/Makefile
Normal file
32
atrf/tools/lib/Makefile
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# lib/Makefile - Build the ATSPI library
|
||||
#
|
||||
# Written 2010 by Werner Almesberger
|
||||
# Copyright 2010 Werner Almesberger
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
F32XBASE = ../../../../f32xbase
|
||||
|
||||
LIB = libatspi.a
|
||||
|
||||
CFLAGS = -Wall -I$(F32XBASE)/include -I../../fw/include -I../include
|
||||
OBJS = $(F32XBASE)/lib/usb.o atspi.o
|
||||
|
||||
.PHONY: all clean spotless
|
||||
|
||||
all: $(LIB)
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
$(AR) cr $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
|
||||
spotless: clean
|
||||
rm -f $(LIB)
|
||||
143
atrf/tools/lib/atspi.c
Normal file
143
atrf/tools/lib/atspi.c
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* lib/atspi.c - ATSPI access functions library
|
||||
*
|
||||
* Written 2010 by Werner Almesberger
|
||||
* Copyright 2010 Werner Almesberger
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <usb.h>
|
||||
|
||||
#include "f32xbase/usb.h"
|
||||
#include "atspi/ep0.h"
|
||||
#include "atspi/usb-ids.h"
|
||||
|
||||
#include "atspi.h"
|
||||
|
||||
|
||||
#define FROM_DEV ATSPI_FROM_DEV(0)
|
||||
#define TO_DEV ATSPI_TO_DEV(0)
|
||||
|
||||
|
||||
/* ----- error handling ---------------------------------------------------- */
|
||||
|
||||
|
||||
static int error;
|
||||
|
||||
|
||||
int atspi_error(void)
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
int atspi_clear_error(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = error;
|
||||
error = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* ----- open/close -------------------------------------------------------- */
|
||||
|
||||
|
||||
usb_dev_handle *atspi_open(void)
|
||||
{
|
||||
usb_dev_handle *dev;
|
||||
|
||||
dev = open_usb(USB_VENDOR, USB_PRODUCT);
|
||||
if (dev) {
|
||||
error = 0;
|
||||
} else {
|
||||
fprintf(stderr, ":-(\n");
|
||||
error = 1;
|
||||
}
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
void atspi_close(usb_dev_handle *dev)
|
||||
{
|
||||
/* to do */
|
||||
}
|
||||
|
||||
|
||||
/* ----- device mode ------------------------------------------------------- */
|
||||
|
||||
|
||||
void atspi_reset(usb_dev_handle *dev)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (error)
|
||||
return;
|
||||
|
||||
res =
|
||||
usb_control_msg(dev, TO_DEV, ATSPI_RESET, 0, 0, NULL, 0, 1000);
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "ATSPI_RESET: %d\n", res);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void atspi_reset_rf(usb_dev_handle *dev)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (error)
|
||||
return;
|
||||
|
||||
res =
|
||||
usb_control_msg(dev, TO_DEV, ATSPI_RF_RESET, 0, 0, NULL, 0, 1000);
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "ATSPI_RF_RESET: %d\n", res);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ----- register access --------------------------------------------------- */
|
||||
|
||||
|
||||
void atspi_reg_write(usb_dev_handle *dev, uint8_t reg, uint8_t value)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (error)
|
||||
return;
|
||||
|
||||
res = usb_control_msg(dev, TO_DEV, ATSPI_REG_WRITE, value, reg,
|
||||
NULL, 0, 1000);
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "ATSPI_REG_WRITE: %d\n", res);
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8_t atspi_reg_read(usb_dev_handle *dev, uint8_t reg)
|
||||
{
|
||||
uint8_t value = 0;
|
||||
int res;
|
||||
|
||||
if (error)
|
||||
return 0;
|
||||
|
||||
res = usb_control_msg(dev, FROM_DEV, ATSPI_REG_READ, 0, reg,
|
||||
(void *) &value, 1, 1000);
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "ATSPI_REG_READ: %d\n", res);
|
||||
error = 1;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
Reference in New Issue
Block a user