nfc-poll command stops polling after 30000ms by default when using libnfc library.
I need an endless polling when calling this command from the raspberry pi 3 b+ (raspbian stretch) command line.
I´ve looked into the libnfc library source code and saw that the function nfc_initiator_poll_target that is in charge of polling the nfc target can receive a parameter 0xFF for configuring an endless polling, but this is a function written in C, and I haven´t found the way to pass this parameter from command line when executing nfc-poll.
// So I typed the following from command line of the raspberry pi 3 b+.
nfc-poll
Then I can see the resulting information after typing the above command as:
NFC device will poll during 30000ms (20 pollings of 300 ms for 5 modulations)
So, what I´m looking for is a way to configure an endless polling, not just 20 pollings.
Is there any way to configure or pass a parameter for setting up the endless polling from the command line?
Note: I´m asking this because I´m using this command of the libnfc library in a python script. So I do not want my script stops/crashes after the 30000ms timer expires which is configured by default by the libnfc library itself.
Related
I want to use DMtimer of beaglebone to set timer of 1 minute.Can anybody guide me with the procedure for the same?I have worked with Pic micro controller and it's timers so I know the working of timer,but in terms of programming and register handling in the beaglebone it seems to be work in different manner.can anybody please guide me through this?
following are the details of my beaglebone green
uname -r
4.14.71-ti-r80
cat /etc/dogtag
BeagleBoard.org Debian Image 2018-10-07
cat /etc/debian_version
9.5
trying to write c code in linux ubuntu
The following answer assumes that you are trying to create a user space program (as opposed to kernel space code such as a typical driver).
On a full OS such as Linux you don't manipulate registers to program a timer. You rather make use of kernel APIs.
Depending on the structure of your program there are a number of options.
If you have an event loop (via poll or select) you might want to use the timerfd API. See http://man7.org/linux/man-pages/man2/timerfd_create.2.html.
If you want an asynchronous notification via a signal you can use setitimer. See: http://man7.org/linux/man-pages/man2/setitimer.2.html
In general I would try to avoid signals due to their asynchronous nature.
I have a problem with downloading files from a server, the problem is when I start to download files, download speed is good but after a couple, second download speed decreasing.
I am using aria2c and wants to there is any way to pause and resume download every 5 seconds?
I solve my problem by using aria2c RPC INTERFACE.
aria2 provides JSON-RPC over HTTP and XML-RPC over HTTP interfaces that offer basically the same functionality. aria2 also provides JSON-RPC over WebSocket
I write a script in Node.js which use aria2.pause and aria2.unpause for pause and resume every 5 seconds
I have a problem where I need to check the TCP packets on a machine.
We use a closed source VOIP system here and I want to open a program when an incoming calls happens.
The VOIP system's software shows the call, however has no functionality to call external software.
I used Wireshark to capture my PCs packets and I'm able to filter the packets easily by
ip.src==AAA.BBB.CCC.DDD && giop.request_op == "pushEvents" && giop.len > 300 && tcp contains "CallInfo"
Now I can work with this package if my custom software could read the package from pipe
Is there a library for purebasic that can do this capturing and filtering??
Alternatively Is there a way to trigger wireshark (console start) so it outputs the filtered data to pipe? (I noticed tshark could do this but does not support this display filter)
Thanks for any constructive answer not hitting me for rtfm ;-)
tshark is just a terminal/console interface to the same engine as GUI Wireshark. It should support all the same protocol dissectors and display filters as GUI app.
I'm pretty sure you're doing something wrong while launching it. Please provide more info why you didn't manage to get tshark working.
To solve your problem: I would launch a tshark with the filter you've come up with so only those packets are displayed on the output. Then I would pipe the output to the simple python/bash/whatever script that launches the app you want on every line of input.
You will also need to take care of specific situations like:
ensure the input line is what it was supposed to be (you can get error lines etc from tshark)
perhaps avoid launching the app if it's already running
I'm making a bash script to send commands to a launched program, the only way I founded on internet was through named pipes.
Is there an easier way to do it all inside the same script? Because named pipes have the problem that I must have 3 scripts, one for managing the program, other sending the information from the main and then the reader to parse the information to the program (If I correctly understood the above link).
And that is a problem as the manager has to call the others because I need the reader to recieve an array of files as input and I found no way of doing so, if you know how please answer this other question.
Thank you
--- 26/01/2012 ---
After Carl post I tried
#!/bin/bash
MUS_DIR="/home/foo/dir/music"
/usr/bin/expect <<-_EOF_
spawn vlc --global-key-next n $MUS_DIR
sleep 5
send 'n'
sleep 5
send "n"
_EOF_
But it doesn't work, it just spawns vlc but it doesn't skip the song
You might want to check out expect(1).
More details about the program you want to communicate with would be useful.
Essentially you just need some sort of inter process communication. Files/pipes/signals/sockets could be used. Write to a specific file in the script and then send an interrupt the program so it knows to check the file, for example.
Depending on your language of choice, and how much time you can spend on this/how big this project will be. You could have the launched program use a thread to listen on a port for TCP packets and react to them. Then in your bash script you could netcat the information, or send an HTTP POST with curl.
Are you sure it's not possible for the application to be started by the script? Allowing the script to just pass arguments or define some environment variables.
I've created a simple Go application on a Mac for writing and reading data to and from a TCP connection. I've used the GAE Go version. Later, I ported that program to Windows, and I got this error :
Connection.SetReadTimeout undefined (type *net.TCPConn has no field or method SetReadTimeout)
I guess the net package information on the Golang website describes the package only for the GAE version. How would I properly set the timeout in a non-GAE Go version?
With latest weekly (aka Go 1 RC2) one has to use the various Set*Deadline methods of the net.Conn type. Note that the old timeouts were relative to some event, deadlines are absolute times. The background for this change is roughly: setting a [relative] timeout of 1 s seems like a good idea in some scenario, but it applied to every event, like receiving a single byte, thus allowing crafted transfers to avoid timeouts forever (with the respective DOS nearby).