[oe] [PATCH v2] libsocketcan: new recipe
Vitus Jensen
vjensen at gmx.de
Sat May 1 14:22:46 UTC 2010
Builds pengutronix' libsocketcan (using the new netlink interface to access
CAN drivers)
Signed-off-by: Vitus Jensen <vjensen at gmx.de>
---
...ve-headers-supplied-by-linux-libc-headers.patch | 155 ++++++++++++++++++++
recipes/socketcan/libsocketcan_0.0.7.bb | 17 ++
2 files changed, 172 insertions(+), 0 deletions(-)
create mode 100644 recipes/socketcan/files/0001-remove-headers-supplied-by-linux-libc-headers.patch
create mode 100644 recipes/socketcan/libsocketcan_0.0.7.bb
diff --git a/recipes/socketcan/files/0001-remove-headers-supplied-by-linux-libc-headers.patch b/recipes/socketcan/files/0001-remove-headers-supplied-by-linux-libc-headers.patch
new file mode 100644
index 0000000..0a779dc
--- /dev/null
+++ b/recipes/socketcan/files/0001-remove-headers-supplied-by-linux-libc-headers.patch
@@ -0,0 +1,155 @@
+[PATCH] remove headers supplied by linux-libc-headers
+
+---
+ include/GNUmakefile.am | 3 +-
+ include/can_netlink.h | 113 ------------------------------------------------
+ include/libsocketcan.h | 2 +-
+ 3 files changed, 2 insertions(+), 116 deletions(-)
+ delete mode 100644 include/can_netlink.h
+
+diff --git a/include/GNUmakefile.am b/include/GNUmakefile.am
+index 4ba2798..7d7be99 100644
+--- a/include/GNUmakefile.am
++++ b/include/GNUmakefile.am
+@@ -1,5 +1,4 @@
+-noinst_HEADERS = \
+- can_netlink.h
++noinst_HEADERS =
+
+ nobase_include_HEADERS = \
+ libsocketcan.h
+diff --git a/include/can_netlink.h b/include/can_netlink.h
+deleted file mode 100644
+index 9ecbb78..0000000
+--- a/include/can_netlink.h
++++ /dev/null
+@@ -1,113 +0,0 @@
+-/*
+- * linux/can/netlink.h
+- *
+- * Definitions for the CAN netlink interface
+- *
+- * Copyright (c) 2009 Wolfgang Grandegger <wg at grandegger.com>
+- *
+- * Send feedback to <socketcan-users at lists.berlios.de>
+- *
+- */
+-
+-#ifndef CAN_NETLINK_H
+-#define CAN_NETLINK_H
+-
+-#include <linux/types.h>
+-
+-/*
+- * CAN bit-timing parameters
+- *
+- * For futher information, please read chapter "8 BIT TIMING
+- * REQUIREMENTS" of the "Bosch CAN Specification version 2.0"
+- * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf.
+- */
+-struct can_bittiming {
+- __u32 bitrate; /* Bit-rate in bits/second */
+- __u32 sample_point; /* Sample point in one-tenth of a percent */
+- __u32 tq; /* Time quanta (TQ) in nanoseconds */
+- __u32 prop_seg; /* Propagation segment in TQs */
+- __u32 phase_seg1; /* Phase buffer segment 1 in TQs */
+- __u32 phase_seg2; /* Phase buffer segment 2 in TQs */
+- __u32 sjw; /* Synchronisation jump width in TQs */
+- __u32 brp; /* Bit-rate prescaler */
+-};
+-
+-/*
+- * CAN harware-dependent bit-timing constant
+- *
+- * Used for calculating and checking bit-timing parameters
+- */
+-struct can_bittiming_const {
+- char name[16]; /* Name of the CAN controller hardware */
+- __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */
+- __u32 tseg1_max;
+- __u32 tseg2_min; /* Time segement 2 = phase_seg2 */
+- __u32 tseg2_max;
+- __u32 sjw_max; /* Synchronisation jump width */
+- __u32 brp_min; /* Bit-rate prescaler */
+- __u32 brp_max;
+- __u32 brp_inc;
+-};
+-
+-/*
+- * CAN clock parameters
+- */
+-struct can_clock {
+- __u32 freq; /* CAN system clock frequency in Hz */
+-};
+-
+-/*
+- * CAN operational and error states
+- */
+-enum can_state {
+- CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */
+- CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */
+- CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */
+- CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */
+- CAN_STATE_STOPPED, /* Device is stopped */
+- CAN_STATE_SLEEPING, /* Device is sleeping */
+- CAN_STATE_MAX
+-};
+-
+-/*
+- * CAN controller mode
+- */
+-struct can_ctrlmode {
+- __u32 mask;
+- __u32 flags;
+-};
+-
+-#define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */
+-#define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */
+-#define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */
+-
+-/*
+- * CAN device statistics
+- */
+-struct can_device_stats {
+- __u32 bus_error; /* Bus errors */
+- __u32 error_warning; /* Changes to error warning state */
+- __u32 error_passive; /* Changes to error passive state */
+- __u32 bus_off; /* Changes to bus off state */
+- __u32 arbitration_lost; /* Arbitration lost errors */
+- __u32 restarts; /* CAN controller re-starts */
+-};
+-
+-/*
+- * CAN netlink interface
+- */
+-enum {
+- IFLA_CAN_UNSPEC,
+- IFLA_CAN_BITTIMING,
+- IFLA_CAN_BITTIMING_CONST,
+- IFLA_CAN_CLOCK,
+- IFLA_CAN_STATE,
+- IFLA_CAN_CTRLMODE,
+- IFLA_CAN_RESTART_MS,
+- IFLA_CAN_RESTART,
+- __IFLA_CAN_MAX
+-};
+-
+-#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
+-
+-#endif /* CAN_NETLINK_H */
+diff --git a/include/libsocketcan.h b/include/libsocketcan.h
+index bd2b040..8a92eee 100644
+--- a/include/libsocketcan.h
++++ b/include/libsocketcan.h
+@@ -26,7 +26,7 @@
+ * @brief API overview
+ */
+
+-#include <can_netlink.h>
++#include <linux/can/netlink.h>
+
+ int can_do_restart(const char *name);
+ int can_do_stop(const char *name);
+--
+1.5.6.5
+
diff --git a/recipes/socketcan/libsocketcan_0.0.7.bb b/recipes/socketcan/libsocketcan_0.0.7.bb
new file mode 100644
index 0000000..0ee86f6
--- /dev/null
+++ b/recipes/socketcan/libsocketcan_0.0.7.bb
@@ -0,0 +1,17 @@
+DESCRIPTION = "control basic functions in socketcan from userspace"
+AUTHOR = "Luotao Fu"
+HOMEPAGE = "http://www.pengutronix.de"
+SECTION = "libs/network"
+PRIORITY = "optional"
+LICENSE = "LGPL"
+
+TAG = "v${PV}"
+PR = "r0"
+
+SRC_URI = "git://git.pengutronix.de/git/tools/libsocketcan.git;protocol=git;tag=${TAG} \
+ file://0001-remove-headers-supplied-by-linux-libc-headers.patch;patch=1 \
+ "
+
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig
--
1.5.6.5
More information about the Openembedded-devel
mailing list