Initial commit
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
From e12074b4d195188a9fc2dc46858c70cd2e80c5da Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Solomin <sergey.solomin@us.ibm.com>
|
||||
Date: Tue, 6 Sep 2016 15:36:43 -0500
|
||||
Subject: [PATCH] 4 byte read support 466
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
---
|
||||
tools/i2cdump.c | 34 ++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 34 insertions(+)
|
||||
|
||||
diff --git a/tools/i2cdump.c b/tools/i2cdump.c
|
||||
index b638c3d..6af44a8 100644
|
||||
--- a/tools/i2cdump.c
|
||||
+++ b/tools/i2cdump.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-dev.h>
|
||||
@@ -33,6 +34,8 @@
|
||||
#include "util.h"
|
||||
#include "../version.h"
|
||||
|
||||
+#define I2C_SMBUS_DWORD 7
|
||||
+
|
||||
static void help(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
@@ -46,6 +49,7 @@ static void help(void)
|
||||
" s (SMBus block, deprecated)\n"
|
||||
" i (I2C block)\n"
|
||||
" c (consecutive byte)\n"
|
||||
+ " d (double word)\n"
|
||||
" Append p for SMBus PEC\n");
|
||||
}
|
||||
|
||||
@@ -187,6 +191,9 @@ int main(int argc, char *argv[])
|
||||
} else if (!strncmp(argv[flags+3], "c", 1)) {
|
||||
size = I2C_SMBUS_BYTE;
|
||||
pec = argv[flags+3][1] == 'p';
|
||||
+ } else if (!strncmp(argv[flags+3], "d", 1)) {
|
||||
+ size = I2C_SMBUS_DWORD;
|
||||
+ pec = argv[flags+3][1] == 'p';
|
||||
} else if (!strcmp(argv[flags+3], "i"))
|
||||
size = I2C_SMBUS_I2C_BLOCK_DATA;
|
||||
else {
|
||||
@@ -289,6 +296,7 @@ int main(int argc, char *argv[])
|
||||
size == I2C_SMBUS_BLOCK_DATA ? "smbus block" :
|
||||
size == I2C_SMBUS_I2C_BLOCK_DATA ? "i2c block" :
|
||||
size == I2C_SMBUS_BYTE ? "byte consecutive read" :
|
||||
+ size == I2C_SMBUS_DWORD ? "double word" :
|
||||
size == I2C_SMBUS_BYTE_DATA ? "byte" : "word");
|
||||
if (pec)
|
||||
fprintf(stderr, "PEC checking enabled.\n");
|
||||
@@ -317,6 +325,32 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
+ /* handle mode 'd' (double word read) */
|
||||
+ if (size == I2C_SMBUS_DWORD) {
|
||||
+ unsigned char buff[sizeof(uint32_t)];
|
||||
+ struct i2c_rdwr_ioctl_data msgset;
|
||||
+ struct i2c_msg msg[1];
|
||||
+
|
||||
+ msg[0].addr = address;
|
||||
+ msg[0].flags = I2C_M_RD;
|
||||
+ msg[0].len = sizeof(buff);
|
||||
+ msg[0].buf = buff;
|
||||
+
|
||||
+ msgset.msgs = msg;
|
||||
+ msgset.nmsgs = 1;
|
||||
+
|
||||
+ if (ioctl( file, I2C_RDWR, &msgset ) < 0) {
|
||||
+ fprintf(stderr, "Error: Could not read "
|
||||
+ "double word. %s\n", strerror(errno));
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ for (uint8_t n = 0; n < sizeof(buff); n++) {
|
||||
+ printf ("%02x ", buff[n]);
|
||||
+ }
|
||||
+ printf ("\n");
|
||||
+ exit(0);
|
||||
+ }
|
||||
+
|
||||
/* See Winbond w83781d data sheet for bank details */
|
||||
if (bank && size != I2C_SMBUS_BLOCK_DATA) {
|
||||
res = i2c_smbus_read_byte_data(file, bankreg);
|
||||
--
|
||||
2.39.3
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI =+ "file://0001-4-byte-read-support-466.patch"
|
||||
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Install iotool links
|
||||
|
||||
[Service]
|
||||
RemainAfterExit=no
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/env iotools --make-links
|
||||
SyslogIdentifier=iotools
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,26 @@
|
||||
DESCRIPTION = "Command line tools for hardware device registers"
|
||||
HOMEPAGE = "https://github.com/jonmayergoogle/iotools"
|
||||
LICENSE = "GPL-2.0-or-later"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
|
||||
SRCREV = "8d928b3360246b8ead95b442ca3887ce8b8f942f"
|
||||
PV = "v1.6+git${SRCPV}"
|
||||
|
||||
SRC_URI = "git://git@github.com/jonmayergoogle/iotools.git;protocol=https;branch=master"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
SYSTEMD_SERVICE:${PN} += "iotools-setup.service"
|
||||
|
||||
inherit obmc-phosphor-systemd
|
||||
|
||||
do_compile() {
|
||||
# CC is overridden in the Makefile, so override it harder in the invocation
|
||||
oe_runmake CC="${CC}" DEBUG="${DEBUG_BUILD-0}" STATIC=0
|
||||
}
|
||||
# The "install" make target runs the binary to create links for subcommands.
|
||||
# The links are excessive and this doesn't work for cross compiling.
|
||||
do_install() {
|
||||
install -d ${D}${sbindir}
|
||||
install -m 0755 iotools ${D}${sbindir}
|
||||
}
|
||||
|
||||
FILES:${PN} = "${sbindir}"
|
||||
@@ -0,0 +1,17 @@
|
||||
SUMMARY = "YAML::Tiny Version 1.73"
|
||||
HOMEPAGE = "https://metacpan.org/release/YAML-Tiny"
|
||||
LICENSE = "Artistic-1.0 | GPL-1.0+"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
|
||||
file://${COMMON_LICENSE_DIR}/GPL-1.0-or-later;md5=30c0b8a5048cc2f4be5ff15ef0d8cf61"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI += "https://cpan.metacpan.org/authors/id/E/ET/ETHER/YAML-Tiny-1.73.tar.gz"
|
||||
SRC_URI[md5sum] = "d1bb2525e4ab46bfab4b22842c467529"
|
||||
SRC_URI[sha256sum] = "bc315fa12e8f1e3ee5e2f430d90b708a5dc7e47c867dba8dce3a6b8fbe257744"
|
||||
|
||||
S = "${WORKDIR}/YAML-Tiny-${PV}"
|
||||
|
||||
inherit cpan
|
||||
inherit allarch
|
||||
|
||||
BBCLASSEXTEND = "native"
|
||||
@@ -0,0 +1,6 @@
|
||||
inherit update-alternatives
|
||||
|
||||
ALTERNATIVE_LINK_NAME[python] = "${bindir}/python"
|
||||
|
||||
ALTERNATIVE:${PN}-core += "python"
|
||||
ALTERNATIVE_TARGET[python] = "${bindir}/python3"
|
||||
@@ -0,0 +1,7 @@
|
||||
DEPENDS:append:class-target = " popt zlib"
|
||||
PACKAGECONFIG = ""
|
||||
|
||||
EXTRA_OECONF:append:class-target = " \
|
||||
--disable-locale --disable-iconv \
|
||||
--without-included-popt --without-included-zlib \
|
||||
"
|
||||
Reference in New Issue
Block a user