My Wiki!

Compiling ima-carpc package

prepare maketools

  ./autogen.sh
  mkdir build
  cp build_script.sh build
  cd build; ./build_script.sh
  

carpcd: configure.ac

139 # Set -DUCLIBC_OWRT and put it in config.h.in
140 AM_CONDITIONAL([UCLIBC_OWRT], [test 1])
141 AC_DEFINE([UCLIBC_OWRT],[1],[Compile on openwrt_uclibc])
142 
143 AM_CONDITIONAL([GPS_DEBUG], [test ])
144 AC_DEFINE([GPS_DEBUG],[0],[Test with gpsd ver. < 2.5])

carpcd: src/Makefile.am

 36 if UCLIBC_OWRT
 37 AM_CPPFLAGS += -DUCLIBC_OWRT @OONET_CPPFLAGS@ @DAIUTIL_CPPFLAGS@ @YAJL_CPPFLAGS@ \
 38                @LIBPHIDGET_CPPFLAGS@ \
 39                $(GPSD_CPPFLAGS)
 40 endif

IMA carpcd packaging

We are using Attitude Adjustment.

12.09 branch (Attitude Adjustment)

Main repository

git clone git://git.openwrt.org/12.09/openwrt.git

Packages feed

git clone git://git.openwrt.org/12.09/packages.git

Check out certain revision

git commits are tagged with SVN ids.

git log --grep=<svn id>

Git create own branch td_xxxx

Usefulness

  [dang@localhost openwrt]$ find feeds -name *gdb*
  feeds/packages.tmp/info/.packageinfo-libs_gdbm
  feeds/packages/libs/gdbm
  feeds/packages/net/dsniff/patches/003-gdbm.patch
  [dang@localhost openwrt]$ find package/ -name *gdb*

Fix Other packages

carpcd

  1. libgpsmm.h not available by default so fix libgps.

vim feeds/packages/net/gpsd/Makefile

 95 SCONS_OPTIONS += \
 96   dbus_export=no \
 97   tsip=no \
 98   fv18=no \
 99   tripmate=no \
100   earthmate=no \
101   itrax=no \
102   navcom=no \
103   ubx=no \
104   evermore=no \
105   ntrip=no \
106   libgpsmm=yes \   <---------- enable it!
107   libQgpsmm=no \
108   bluez=no \
109   strip=no \
...
114 define Build/InstallDev
115   $(INSTALL_DIR) $(1)/usr/include
116   $(CP) $(PKG_INSTALL_DIR)/usr/include/gps.h $(1)/usr/include/
117   $(CP) $(PKG_INSTALL_DIR)/usr/include/libgpsmm.h $(1)/usr/include/   <------ make libgpsmm.h available after installation
118   $(INSTALL_DIR) $(1)/usr/lib
119   $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgps*.so* $(1)/usr/lib/
120   $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
121   $(CP) \
122     $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libgps*.pc \
123     $(1)/usr/lib/pkgconfig/
124 endef
  1. libstdcpp is also not available. <code> 38 define Package/gpsd 39 $(call Package/gpsd/Default) 40 SECTION:=net 41 CATEGORY:=Network 42 DEPENDS+= +libgps +libgpsd +libstdcpp ←—- add libstdcpp 43 TITLE:=An interface daemon for GPS receivers 44 endef … 69 define Package/libgps 70 $(call Package/gpsd/Default) 71 SECTION:=libs 72 CATEGORY:=Libraries 73 DEPENDS+= +libcap +libstdcpp ←—- add libstdcpp 74 TITLE:=C service library for communicating with the GPS daemon 75 endef

</code>

webcam motion ffmpeg

  • ffmpeg needs
  • ffprobe
  • ffserver

NFC

NFC Spec

TNF

Empty 0x00
NFC Forum well-known type [NFC RTD] 0x01
Media-type as defined in RFC 2046 [RFC 2046] 0x02
Absolute URI as defined in RFC 3986 [RFC 3986] 0x03
NFC Forum external type [NFC RTD] 0x04
Unknown 0x05
Unchanged (see section 2.3.3) 0x06
Reserved 0x07

Sample message:

SnepLength=60
N DEF RECORDS: 2
Record0
0x7f0550000990
Record1
0x7f0550000b70
Version: 10
MessageCode: 2
Snep Length: 60
NDefRecord 0: 
>> Ndef HeaderFlags: 82
>>>> TNF: 2           <------------    
>>>> IL: 0
>>>> SR: 0
>>>> CF: 0
>>>> ME: 0
>>>> MB: 1
>> Type: application/com.example.nfc_test
>> Payload length: 11
>> Payload: test1 test2 test3
NDefRecord 1: 
>> Ndef HeaderFlags: 44
>>>> TNF: 4
>>>> IL: 0
>>>> SR: 0
>>>> CF: 0
>>>> ME: 1
>>>> MB: 0
>> Type: android.com.pkg
>> Payload length: 14
>> Payload: com.example.nfc_test

NFC device used

NFCClient dev

[dang@localhost build]$ sudo ./src/nfcclient 
 ***** start ***** 
libnfc-llcp.llc.link	service 0x16ae6c0 bound to SAP 1
libnfc-llcp.llc.link	service 0x16ae5f0 bound to SAP 32
mac_link_activate_as_initiator
libnfc-llcp.mac.link	(pn532_uart:/dev/ttyUSB1) Attempting to activate LLCP Link as initiator
libnfc-llcp.mac.link	(pn532_uart:/dev/ttyUSB1) nfc_initiator_init() succeeded
libnfc-llcp.mac.link	(pn532_uart:/dev/ttyUSB1) nfc_initiator_poll_dep_target() succeeded
libnfc-llcp.mac.link	(pn532_uart:/dev/ttyUSB1) LLCP Link activated (initiator)
libnfc-llcp.llc.link	llc_link_configure (0x16adf00, (nil), 0)
libnfc-llcp.llc.link	mq_open (/libnfc-llcp-2548-0x16adf00-up)
libnfc-llcp.llc.link	mq_open (/libnfc-llcp-2548-0x16adf00-down)
libnfc-llcp.llc.link	LLC Link started successfully
libnfc-llcp.llc.llc	(0x7f855525a700) Link activated
libnfc-llcp.llc.llc	(0x7f855525a700) mq_receive+
llc_connection_wait()
libnfc-llcp.mac.link	Sending 2 bytes
libnfc-llcp.mac.link	LTOs: 1000 ms (local), 100 ms (remote)
libnfc-llcp.mac.link	Received 2 bytes (Requested 8192, buffer size 2)
libnfc-llcp.mac.link	Received 2 PDU bytes
libnfc-llcp.llc.llc	(0x7f855525a700) Received 2 byteslibnfc-llcp.mac.link	
Sending 19 bytes
libnfc-llcp.mac.link	Sending 19 bytes
libnfc-llcp.mac.link	LTOs: 1000 ms (local), 100 ms (remote)
libnfc-llcp.llc.llc	(0x7f855525a700) Symmetry PDU
libnfc-llcp.llc.llc	(0x7f855525a700) Read -1 bytes from service 32

libnfc-llcp.llc.llc	(0x7f855525a700) mq_send+
libnfc-llcp.llc.llc	(0x7f855525a700) Nothing to send
libnfc-llcp.llc.llc	(0x7f855525a700) mq_receive+
libnfc-llcp.mac.link	Received 2 bytes (Requested 8192, buffer size 2)
libnfc-llcp.mac.link	Received 2 PDU bytes
libnfc-llcp.llc.llc	(0x7f855525a700) Received 2 bytes
libnfc-llcp.mac.link	libnfc-llcp.llc.llc	(0x7f855525a700) Symmetry PDU
Sending 2 bytes
libnfc-llcp.mac.link	Sending 2 bytes
libnfc-llcp.mac.link	LTOs: 1000 ms (local), 100 ms (remote)
libnfc-llcp.llc.llc	(0x7f855525a700) Read -1 bytes from service 32

libnfc-llcp.llc.llc	(0x7f855525a700) mq_send+
libnfc-llcp.llc.llc	(0x7f855525a700) Nothing to send
libnfc-llcp.llc.llc	(0x7f855525a700) mq_receive+
libnfc-llcp.mac.link	Received 2 bytes (Requested 8192, buffer size 2)
libnfc-llcp.mac.link	Received 2 PDU bytes
libnfc-llcp.llc.llc	(0x7f855525a700) Received 2 bytes
libnfc-llcp.llc.llc	(0x7f855525a700) Connection Complete PDU
libnfc-llcp.llc.llc	(0x7f855525a700) Read -1 bytes from service 32

service start
libnfc-llcp.mac.link	Sending 2 bytes
libnfc-llcp.mac.link	Sending 2 bytes
libnfc-llcp.mac.link	LTOs: 1000 ms (local), 100 ms (remote)
Status is now connected
libnfc-llcp.llc.llc	(0x7f855525a700) mq_send+
libnfc-llcp.llc.llc	(0x7f855525a700) Nothing to send
libnfc-llcp.llc.llc	(0x7f855525a700) mq_receive+
setMessageBegin
setMessageEnd
NdefRecord::encode()
NdefRecord::encode()
SnepLength=64
N DEF RECORDS: 2
Record0
0x7f8548000990
Record1
0x7f8548000b70
Version: 10
MessageCode: 2
Snep Length: 64
NDefRecord 0: 
>> Ndef HeaderFlags: 82
>>>> TNF: 2
>>>> IL: 0
>>>> SR: 0
>>>> CF: 0
>>>> ME: 0
>>>> MB: 1
>> Type: application/com.example.android.beam
>> Payload length: 11
>> Payload: test1 test2 test3
NDefRecord 1: 
>> Ndef HeaderFlags: 44
>>>> TNF: 4
>>>> IL: 0
>>>> SR: 0
>>>> CF: 0
>>>> ME: 1
>>>> MB: 0
>> Type: android.com.pkg
>> Payload length: 14
>> Payload: com.example.nfc_test

Message: 
10 2 0 0 0 64 82 24 0 0 0 11 61 70 70 6c 69 63 61 74 69 6f 6e 2f 63 6f 6d 2e 65 78 61 6d 70 6c 65 2e 61 6e 64 72 6f 69 64 2e 62 65 61 6d 74 65 73 74 31 20 74 65 73 74 32 20 74 65 73 74 33 44 f 0 0 0 14 61 6e 64 72 6f 69 64 2e 63 6f 6d 2e 70 6b 67 63 6f 6d 2e 65 78 61 6d 70 6c 65 2e 6e 66 63 5f 74 65 73 74 
Encoded message: 
d�$application/com.example.android.beamtest1 test2 test3Dandroid.com.pkgcom.example.nfc_test
libnfc-llcp.mac.link	Received 2 bytes (Requested 8192, buffer size 2)
libnfc-llcp.mac.link	Received 2 PDU bytes
libnfc-llcp.llc.llc	(0x7f855525a700) Received 2 bytes
libnfc-llcp.mac.link	Sending 2 bytes
libnfc-llcp.mac.link	Sending 2 bytes
libnfc-llcp.mac.link	LTOs: 1000 ms (local), 100 ms (remote)
libnfc-llcp.llc.llc	(0x7f855525a700) Symmetry PDU
libnfc-llcp.llc.llc	(0x7f855525a700) Read 109 bytes from service 32

libnfc-llcp.llc.llc	(0x7f855525a700) mq_send+
libnfc-llcp.llc.llc	(0x7f855525a700) Sent 109 bytes
libnfc-llcp.llc.llc	(0x7f855525a700) mq_receive+
libnfc-llcp.mac.link	Received 2 bytes (Requested 8192, buffer size 2)
libnfc-llcp.mac.link	Received 2 PDU bytes
libnfc-llcp.mac.link	Sending 109 bytes
libnfc-llcp.mac.link	Sending 109 bytes
libnfc-llcp.mac.link	LTOs: 1000 ms (local), 100 ms (remote)
libnfc-llcp.llc.llc	(0x7f855525a700) Received 2 bytes
libnfc-llcp.llc.llc	(0x7f855525a700) Symmetry PDU
libnfc-llcp.llc.llc	(0x7f855525a700) Read -1 bytes from service 32

libnfc-llcp.llc.llc	(0x7f855525a700) mq_send+
libnfc-llcp.llc.llc	(0x7f855525a700) Nothing to send
libnfc-llcp.llc.llc	(0x7f855525a700) mq_receive+
libnfc-llcp.mac.link	Received 3 bytes (Requested 8192, buffer size 3)
libnfc-llcp.mac.link	Received 3 PDU bytes
libnfc-llcp.llc.llc	(0x7f855525a700) Received 3 bytes
libnfc-llcp.mac.link	libnfc-llcp.llc.llc	Sending 2 bytes(0x7f855525a700) Receive Ready PDU

libnfc-llcp.mac.link	Sending 2 bytes
libnfc-llcp.mac.link	LTOs: 1000 ms (local), 100 ms (remote)
libnfc-llcp.llc.llc	(0x7f855525a700) Read -1 bytes from service 32

libnfc-llcp.llc.llc	(0x7f855525a700) mq_send+
libnfc-llcp.llc.llc	(0x7f855525a700) Nothing to send
libnfc-llcp.llc.llc	(0x7f855525a700) mq_receive+
libnfc-llcp.mac.link	Received 9 bytes (Requested 8192, buffer size 9)
libnfc-llcp.mac.link	Received 9 PDU bytes
libnfc-llcp.llc.llc	(0x7f855525a700) Received 9 bytes
NOT NULL
10 81 00 00 00 00 00 00 6a 00 00 00 00 libnfc-llcp.mac.link	00 Sending 2 bytes
libnfc-llcp.mac.link	Sending 2 bytes
libnfc-llcp.mac.link	LTOs: 1000 ms (local), 100 ms (remote)
00 00 c0 0a 00 50 85 7f 00 00 85 00 00 00 00 00 00 
libnfc-llcp.llc.llc	(0x7f855525a700) Information PDU
libnfc-llcp.llc.llc	(0x7f855525a700) Send 9 bytes to service 32
Send NDEF message done.
libnfc-llcp.llc.llc	�(0x7f855525a700) Read -1 bytes from service 32

libnfc-llcp.llc.llc	(0x7f855525a700) Send acknoledgment for received data

libnfc-llcp.llc.llc	(0x7f855525a700) mq_send+
libnfc-llcp.llc.llc	(0x7f855525a700) Sent 3 bytes
libnfc-llcp.llc.llc	(0x7f855525a700) mq_receive+
libnfc-llcp.llc.connection	Stopping Data Link Connection [32 -> 4]
libnfc-llcp.llc.link	Deactivating LLC Link
libnfc-llcp.llc.link	The LLC Link has an active MAC link
libnfc-llcp.mac.link	MAC Link deactivation requested (reason: 0)
libnfc-llcp.mac.link	Received 2 bytes (Requested 8192, buffer size 2)
libnfc-llcp.mac.link	MAC Link deactivated
libnfc-llcp.llc.link	Back to LLC Link deactivation
libnfc-llcp.llc.link	Stopping Data Link Connection [4205912 -> -1126872448]
libnfc-llcp.llc.connection	Stopping Data Link Connection [32 -> 4]
libnfc-llcp.llc.connection	Freeing Data Link Connection [32 -> 4]
libnfc-llcp.llc.link	Data Link Connection [4205912 -> -1126872448] stopped
libnfc-llcp.llc.link	LLC Link deactivated
libnfc-llcp.llc.link	Freeing service 32
libnfc-llcp.llc.link	Freeing service 1
[dang@localhost build]$ 

NFC/nfcclient on openwrt

Device driver error: Unexpected PN53x reply!

Error

  LIBNFC_LOG_LEVEL=3 nfc-list
root@imaopenwrt:~# nfc-list 
nfc-list uses libnfc 1.7.0
error	libnfc.chip.pn53x	Unexpected PN53x reply!
pn53x_check_communication: Input / Output Error
error	libnfc.chip.pn53x	Unexpected PN53x reply!
nfc-list: ERROR: Unable to open NFC device: pn532_uart:/dev/ttyUSB0

Solution

Compile libnfc-1.7.1

compile libllcp and test

Device not found:

Resolution:

  • configure device name in /etc/nfc/nfc.conf.
# Manually set default device (no default)
# To set a default device, you must set both name and connstring for your device
# Note: if autoscan is enabled, default device will be the first device available in device list.
#device.name = "microBuilder.eu"
#device.connstring = "pn532_uart:/dev/ttyUSB0"
device.name = "imanfc"
device.connstring = "pn532_uart:/dev/ttyUSB1"
  • sudo nfc-list

examples/snep-server dbg out put

Segfault:

[pid  3366] <... ioctl resumed> , [0])  = 0
[pid  3365] <... munmap resumed> )      = 0
[pid  3366] write(4, "\0\0\377\4\374\324\216\0\0\236\0", 11 <unfinished ...>
[pid  3365] mprotect(0x7f90a4000000, 135168, PROT_READ|PROT_WRITE <unfinished ...>
[pid  3366] <... write resumed> )       = 11
[pid  3365] <... mprotect resumed> )    = 0
[pid  3366] select(5, [4], NULL, NULL, {0, 350000} <unfinished ...>
[pid  3365] mq_timedreceive(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024, 0, NULL) = -1 EBADF (Bad file descriptor)
[pid  3365] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x55} ---
[pid  3366] +++ killed by SIGSEGV (core dumped) +++
[pid  3365] +++ killed by SIGSEGV (core dumped) +++
+++ killed by SIGSEGV (core dumped) +++

GDB

libnfc-llcp.mac.link	Received 2 PDU bytes
libnfc-llcp.llc.llc	libnfc-llcp.mac.link	Sending 19 bytes(0x7ffff7abe700) Received 2 bytes
libnfc-llcp.llc.llc	(0x7ffff7abe700) Symmetry PDU
libnfc-llcp.llc.llc	(0x7ffff7abe700) Garbage-collecting Logical Data Link [32 -> 1]
libnfc-llcp.llc.connection	Freeing Data Link Connection [32 -> 1]
libnfc-llcp.llc.llc	(0x7ffff7abe700) Can' read from service 73 message queue


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7abe700 (LWP 929)]
llc_service_llc_thread (arg=0x611e40) at llc_service_llc.c:410
410	        length = mq_receive(link->datagram_handlers[i]->llc_down, (char *) buffer, sizeof(buffer), NULL);
Missing separate debuginfos, use: debuginfo-install glibc-2.18-12.fc20.x86_64 libgcc-4.8.2-7.fc20.x86_64 libnfc-1.7.0-1.fc20.x86_64 libselinux-2.2.1-6.fc20.x86_64 libstdc++-4.8.2-7.fc20.x86_64 libusb-0.1.5-3.fc20.x86_64 libusbx-1.0.16-3.fc20.x86_64 pcre-8.33-4.fc20.x86_64 pcsc-lite-libs-1.8.10-1.fc20.x86_64 systemd-libs-208-9.fc20.x86_64 xz-libs-5.1.2-6alpha.fc20.x86_64
(gdb) l
405	
406	    ssize_t length = 0;
407	    for (int i = 0; i <= MAX_LOGICAL_DATA_LINK; i++) {
408	      if (link->datagram_handlers[i]) {
409	        pthread_t thread = link->datagram_handlers[i]->thread;
410	        length = mq_receive(link->datagram_handlers[i]->llc_down, (char *) buffer, sizeof(buffer), NULL);
411	        if (length > 0)
412	          break;
413	        switch (errno) {
414	          case EAGAIN:
(gdb) q

Solution

  • Resolution: Increase MAXLOGICALDATALINK which is the upper-bounce of datagramhandlers[i]. in llcp.h:
 55 //#define MAX_LOGICAL_DATA_LINK 8
 56 #define MAX_LOGICAL_DATA_LINK 80

bug report

 #4 thuydang...@gmail.com

Hi, 

I seem to have problem with "receive" operation using both master- and socket-branch. My settings is Fedora 20 x86_64 <---> Android 4.4.2

I tested the "socket" branch and had ENOTSOCK from strace:

-----------
            ioctl(7, FIONREAD <unfinished ...>
[pid 18493] select(9, [8], NULL, NULL, {0, 100000} <unfinished ...>
[pid 18492] <... ioctl resumed> , [2])  = 0
[pid 18492] recvfrom(7, "\0\0", 1024, 0, NULL, NULL) = 2
[pid 18492] mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x7fd17761c000
[pid 18492] munmap(0x7fd17761c000, 10371072) = 0
[pid 18492] munmap(0x7fd17c000000, 56737792) = 0
[pid 18492] mprotect(0x7fd178000000, 135168, PROT_READ|PROT_WRITE) = 0
[pid 18492] recvfrom(0, 0x7fd18061a9e0, 1024, 0, 0, 0) = -1 ENOTSOCK (Socket operation on non-socket)
[pid 18492] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x200000025} ---
[pid 18493] +++ killed by SIGSEGV (core dumped) +++
-------------

On the master branch I had EBADF (Bad file descriptor):
-----
[pid 19884] write(4, "\0\0\377\4\374\324\216\0\0\236\0", 11) = 11
[pid 19883] mq_timedreceive(0,  <unfinished ...>
[pid 19884] select(5, [4], NULL, NULL, {0, 350000} <unfinished ...>
[pid 19883] <... mq_timedreceive resumed> "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024, 0, NULL) = -1 EBADF (Bad file descriptor)
[pid 19883] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x55} ---
[pid 19883] +++ killed by SIGSEGV (core dumped) +++
-----


Today (moments ago) Delete comment
#5 thuydang...@gmail.com

Hi, during compilation there is also this warning, which seems to relate to the problem:

---
  CC       llc_link.lo
llc_link.c: In function 'llc_link_new':
llc_link.c:66:34: warning: iteration 8ul invokes undefined behavior [-Waggressive-loop-optimizations]
       link->datagram_handlers[i] = NULL;
                                  ^
llc_link.c:64:5: note: containing loop
     for (size_t i = 0; i < sizeof(link->available_services) / sizeof(*link->available_services); i++) {
     ^
  CC       llc_service.lo
---

Disable aggressive loop optimization:

In configure.ac add:

 CFLAGS="$CFLAGS -std=c99 -fno-aggressive-loop-optimizations"
  
A new option, <code>-fno-aggressive-loop-optimizations

, was added +can be disabled with

-Wno-aggressive-loop-optimizations

.</p>

<p>On ARM, a bug has been fixed in GCC's implementation of the AAPCS rules for the layout of vectors that could lead to wrong code being

</code>

Check mqueue

Ensure CONFIG_POSIX_MQUEUE is enabled

it's not in voyage for example

 grep CONFIG_POSIX_MQUEUE /boot/config-3.10.11-xxx
 # CONFIG_POSIX_MQUEUE is not set

Other problems

GDB nfcclient:

sudo gdb ./src/nfcclient
...
run [return]

error:

 ***** start ***** 
libnfc-llcp.llc.link	service 0x6123c0 bound to SAP 1
libnfc-llcp.mac.link	(pn532_uart:/dev/ttyUSB1) Attempting to activate LLCP Link as initiator
libnfc-llcp.mac.link	(pn532_uart:/dev/ttyUSB1) nfc_initiator_init() succeeded
libnfc-llcp.mac.link	(pn532_uart:/dev/ttyUSB1) nfc_initiator_poll_dep_target() succeeded
libnfc-llcp.mac.link	(pn532_uart:/dev/ttyUSB1) LLCP Link activated (initiator)
libnfc-llcp.llc.link	llc_link_configure (0x611e40, (nil), 0)
libnfc-llcp.llc.link	mq_open (/libnfc-llcp-925-0x611e40-up)
libnfc-llcp.llc.link	mq_open (/libnfc-llcp-925-0x611e40-down)
[New Thread 0x7ffff7abe700 (LWP 929)]
libnfc-llcp.llc.link	LLC Link started successfully
libnfc-llcp.llc.llc	(0x7ffff7abe700) Link activated
libnfc-llcp.llc.llc	(0x7ffff7abe700) mq_receive+
[New Thread 0x7ffff72bd700 (LWP 930)]
libnfc-llcp.llc.link	service 0x6122f0 bound to SAP 32
llc_connection_wait()
libnfc-llcp.mac.link	Sending 2 bytes
libnfc-llcp.mac.link	LTOs: 1000 ms (local), 100 ms (remote)
libnfc-llcp.mac.link	Received 2 bytes (Requested 8192, buffer size 2)
libnfc-llcp.mac.link	Received 2 PDU bytes
libnfc-llcp.llc.llc	libnfc-llcp.mac.link	Sending 19 bytes(0x7ffff7abe700) Received 2 bytes
libnfc-llcp.llc.llc	(0x7ffff7abe700) Symmetry PDU
libnfc-llcp.llc.llc	(0x7ffff7abe700) Garbage-collecting Logical Data Link [32 -> 1]
libnfc-llcp.llc.connection	Freeing Data Link Connection [32 -> 1]
libnfc-llcp.llc.llc	(0x7ffff7abe700) Can' read from service 73 message queue


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7abe700 (LWP 929)]
llc_service_llc_thread (arg=0x611e40) at llc_service_llc.c:410
410	        length = mq_receive(link->datagram_handlers[i]->llc_down, (char *) buffer, sizeof(buffer), NULL);
Missing separate debuginfos, use: debuginfo-install glibc-2.18-12.fc20.x86_64 libgcc-4.8.2-7.fc20.x86_64 libnfc-1.7.0-1.fc20.x86_64 libselinux-2.2.1-6.fc20.x86_64 libstdc++-4.8.2-7.fc20.x86_64 libusb-0.1.5-3.fc20.x86_64 libusbx-1.0.16-3.fc20.x86_64 pcre-8.33-4.fc20.x86_64 pcsc-lite-libs-1.8.10-1.fc20.x86_64 systemd-libs-208-9.fc20.x86_64 xz-libs-5.1.2-6alpha.fc20.x86_64
(gdb) l
405	
406	    ssize_t length = 0;
407	    for (int i = 0; i <= MAX_LOGICAL_DATA_LINK; i++) {
408	      if (link->datagram_handlers[i]) {
409	        pthread_t thread = link->datagram_handlers[i]->thread;
410	        length = mq_receive(link->datagram_handlers[i]->llc_down, (char *) buffer, sizeof(buffer), NULL);
411	        if (length > 0)
412	          break;
413	        switch (errno) {
414	          case EAGAIN:
(gdb) 

Fixing m_queue

Message Size

The default Linux implementation has the maximum message size set to 8192 bytes. That's not a lot of data to be honest, although it would be more than enough for an bridge between Erlang processes for most data. Unfortunately, this is a kernel option, and so to increase it you need to muck with your runtime kernel parameters (/proc/sys/fs/mqueue/msgsize_max).

Maximum Queue Size

The maximum number of messages you can put into the queue before it starts to block the sender is 10 messages. Again, kernel configurable (/proc/sys/fs/mqueue/msg_max), but 10 messages is pretty darn small.

Resources


Navigation