]> granicus.if.org Git - python/commitdiff
Issue #22631: Added Linux-specific socket constant CAN_RAW_FD_FRAMES.
authorLarry Hastings <larry@hastings.org>
Mon, 13 Apr 2015 21:48:40 +0000 (17:48 -0400)
committerLarry Hastings <larry@hastings.org>
Mon, 13 Apr 2015 21:48:40 +0000 (17:48 -0400)
Patch courtesy of Joe Jevnik.

Doc/library/socket.rst
Doc/whatsnew/3.5.rst
Misc/ACKS
Misc/NEWS
Modules/socketmodule.c
configure
configure.ac
pyconfig.h.in

index 530fbb055679b3946a0c460f9fbbf1b0d6eae9d9..84fa10d774ad5f6d2868ba1bad2ac01d3ea69a42 100644 (file)
@@ -279,6 +279,18 @@ Constants
 
    .. versionadded:: 3.4
 
+.. data:: CAN_RAW_FD_FRAMES
+
+   Enables CAN FD support in a CAN_RAW socket. This is disabled by default.
+   This allows your application to send both CAN and CAN FD frames; however,
+   you one must accept both CAN and CAN FD frames when reading from the socket.
+
+   This constant is documented in the Linux documentation.
+
+   Availability: Linux >= 3.6.
+
+   .. versionadded:: 3.5
+
 .. data:: AF_RDS
           PF_RDS
           SOL_RDS
index 7a8c3f8bf38ca1cdbd4473451e9e2be27cedb7d0..a1130df3c8505142eae63d26e9342b3e5de3aecb 100644 (file)
@@ -792,6 +792,9 @@ Changes in the Python API
   in Python 3.5, all old `.pyo` files from previous versions of Python are
   invalid regardless of this PEP.
 
+ * The :mod:`socket` module now exports the CAN_RAW_FD_FRAMES constant on linux
+   3.6 and greater.
+
 Changes in the C API
 --------------------
 
index d1074bda05601202b7fc8b1df92ae7c7015c4ef1..eeb18699e17b5587076c92843307ac15dfdd4212 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -664,6 +664,7 @@ Flemming Kjær Jensen
 Philip H. Jensen
 Philip Jenvey
 MunSic Jeong
+Joe Jevnik
 Chris Jerdonek
 Jim Jewett
 Pedro Diaz Jimenez
index e4574a11c35db43505a2471c3ae8a19601cd89d8..79ed545695f58f389ea592ae014edce0fca1a60c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1,4 +1,4 @@
-+++++++++++
++++++++++++
 Python News
 +++++++++++
 
@@ -9,6 +9,8 @@ Release date: XXX
 
 Core and Builtins
 -----------------
+- Issue #22631: Added Linux-specific socket constant CAN_RAW_FD_FRAMES.
+  Patch courtesy of Joe Jevnik.
 
 - Issue #23731: Implement PEP 488: removal of .pyo files.
 
index fd20b174d3c83a3418a249c286edbca1769a93c3..7610b0c05dd53746575693cd31aec62892b8fd66 100644 (file)
@@ -6617,6 +6617,9 @@ PyInit__socket(void)
     PyModule_AddIntMacro(m, CAN_RAW_LOOPBACK);
     PyModule_AddIntMacro(m, CAN_RAW_RECV_OWN_MSGS);
 #endif
+#ifdef HAVE_LINUX_CAN_RAW_FD_FRAMES
+    PyModule_AddIntMacro(m, CAN_RAW_FD_FRAMES);
+#endif
 #ifdef HAVE_LINUX_CAN_BCM_H
     PyModule_AddIntMacro(m, CAN_BCM);
     PyModule_AddIntConstant(m, "CAN_BCM_TX_SETUP", TX_SETUP);
index 72751ed1f374e4a5f3a88d8ff2f8955a397443a3..26b89112dcf65ee6dde359ac0ad92f2856101f81 100755 (executable)
--- a/configure
+++ b/configure
@@ -10495,6 +10495,36 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
        fi
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CAN_RAW_FD_FRAMES" >&5
+$as_echo_n "checking for CAN_RAW_FD_FRAMES... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ /* CAN_RAW_FD_FRAMES available check */
+#include <linux/can/raw.h>
+int
+main ()
+{
+int can_raw_fd_frames = CAN_RAW_FD_FRAMES;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+
+$as_echo "#define HAVE_LINUX_CAN_RAW_FD_FRAMES 1" >>confdefs.h
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSX 10.5 SDK or later" >&5
 $as_echo_n "checking for OSX 10.5 SDK or later... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
index 69f7b7dd11b82128682eb3becaa66ea04f67dd96..d15f26426d4665d604269036eac91c4183277a4c 100644 (file)
@@ -2876,6 +2876,16 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
        fi
 fi
 
+AC_MSG_CHECKING(for CAN_RAW_FD_FRAMES)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* CAN_RAW_FD_FRAMES available check */
+#include <linux/can/raw.h>]],
+[[int can_raw_fd_frames = CAN_RAW_FD_FRAMES;]])],[
+  AC_DEFINE(HAVE_LINUX_CAN_RAW_FD_FRAMES, 1, [Define if compiling using Linux 3.6 or later.])
+  AC_MSG_RESULT(yes)
+],[
+  AC_MSG_RESULT(no)
+])
+
 AC_MSG_CHECKING(for OSX 10.5 SDK or later)
 AC_COMPILE_IFELSE([
   AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
index c8ce97604510cc3590f380446a59b8d0c944c003..0d40c94cd4c0a36057ef6658e00bb3ae0a5acafa 100644 (file)
 /* Define to 1 if you have the <linux/can.h> header file. */
 #undef HAVE_LINUX_CAN_H
 
+/* Define if compiling using Linux 3.6 or later. */
+#undef HAVE_LINUX_CAN_RAW_FD_FRAMES
+
 /* Define to 1 if you have the <linux/can/raw.h> header file. */
 #undef HAVE_LINUX_CAN_RAW_H