|
Yeah they over-abbreviated the command. Should have spelled it rt fm comm.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
<a href="https://man7.org/linux/man-pages/man3/system.3.html">system(3) - Linux manual page</a>[<a href="https://man7.org/linux/man-pages/man3/system.3.html" target="_blank" title="New Window">^</a>]
This is somewhat a dupe, so if it bothers you...( I am not allowed to give instructions ...)
I am asking for generic / general help in capturing Linux command output.
I am going to use this as an example:
system("hcitool dev | cut -sf3 ");
I know what is does - that is NOT of my concern..
I can see the result in (Qt) console...
I do not know HOW - what "hidden" code (std??) put
the actual result of the call onto console
and
how can I redirect such call for my purpose ?
I did RTFM for "system" and found NO references , or missed them,
on how to capture THE actual output of the command.
that said - what would be SUCCESSFUL phrase to ask Mrs Google to
give me a general Linux resource ( text book ?) to cover
"standard output / input / error "
and
how to figure out if the command uses
"standard output / input / error "
and how to access it in C/C++
..all this just for learning purpose
CHEERS
THANks
|
|
|
|
|
|
I have reached another dead end in my Bluetooth programming...
without getting into details - task works fine when performed in Linux terminal
, but fails to connect when run in C++ code.
After RTFM I found
"the error source" in "bluez " library, burred in few layers of undocumented code ...
So I am going back to "level" where I can control the
usage of "bluez" library...
That means to go back to
https://people.csail.mit.edu/albert/bluez-intro/c404.html[^]
My question
to the forum -
is there a C++ version of the above?
( I asked Mrs Google...)
Yes, the foundation would still be "bluez" library...but if I can
manage to convert the above to C++ it my be "some " progress.
Thanks very much for any constructive help.
|
|
|
|
|
|
Yes, exactly what I was looking for. Thanks.
Actually it has "d-bus" code I need to try to "up code" ,
try a differ approach to Bluetooth coding.
|
|
|
|
|
I have done the individual analysis on my data , now I m trying to run 3dDeconvolve code but it does not work at all. I dont know what is wrong.
|
|
|
|
|
Sevinc Bayar wrote: I dont know what is wrong. It is unlikely that anyone here could guess.
|
|
|
|
|
Nobody is going to be able to help you because you haven't shown the code you've written that has the problem nor even described a problem! Just showing up to a forum and saying "it doesn't work" is a complete waste of your time.
|
|
|
|
|
Also not sure why it is a Linux (this forum problem.)
If anyone else is curious about what it is even about. From National Institutes of Health (pdf).
"Program 3dDeconvolve was developed to provide deconvolution analysis of FMRI time series data."
Found with following google search
what is 3dDeconvolve
|
|
|
|
|
Offhand, I'd guess ther's an error in the code or the keyboard
CQ de W5ALT
Walt Fair, Jr.PhD P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
I am using hcitool to identify local , attached to my PC via USB
Bluetooth adapters.
The actual command is "hcitool dev".
Most of the time I receive hci0 plus address.
Recently I started getting hci1.
If I attach two adapters
I receive
hci0
hcix
where hcix keeps increasing ( the x ) with each, same , hcitool dev command.
I am looking for way to keep the hci0 as hci0.
Thanks very much for your help, it is appreciated very much
|
|
|
|
|
You might want to research your assumptions.
You are assuming that hcitool controls that. Versus just reporting on what is there.
If there is a way to return other attributes you might be able to identify it that way.
I have not worked with this protocol but I have worked with many others so I suggest that you do not assume that your testing by itself will return all possibilities. A general solution might either be coded only to support limited scenarios (those tested) or must provide a way to monitor/report when it is not found, what is found, and potentially a way to configure/add more info to a running app.
|
|
|
|
|
Simple , but Mrs Google gives " where space is "....and not "whereis"....
|
|
|
|
|
|
You can put double quotes around word/phrase in google to force it.
Salvatore Terress wrote: "whereis" recursively
I doubt that makes any sense. Whereis already recurses via something (execution path?).
Googling shows options for whereis that allows one to limit the search but not expand it.
|
|
|
|
|
The linux command whereis has no recursive invocation. From the man page:
Quote: whereis locates the binary, source and manual files for the specified command names. The supplied names are first
stripped of leading pathname components. Prefixes of s. resulting from use of source code control are also dealt with.
whereis then attempts to locate the desired program in the standard Linux places, and in the places specified by $PATH
and $MANPATH.
Maybe you're thinking more of find , which searches given directories for a file matching a pattern? e.g. find $HOME -name 'mumble*.cpp' . Or maybe locate which will find files anywhere on the system that you have access to (i.e. the results for user1 may be different from user2, and both may be different from root)
"A little song, a little dance, a little seltzer down your pants"
Chuckles the clown
|
|
|
|
|
This is NOT problem / does not requires code / details and answer.
Basic statement
"bluez" (library) is part of the Linux kernel.
Academic question:
what is the basic / fundamental access of Bluetooth to Linux kernel ?
Is bypassing "bluez / hci " the way ?
"bluez" library uses "hci" "commands" , other GUI applications / commands are "free to utilize bluez" ....
For example - Qt uses "bluez" but have no means to actually reset Bluetooth devices - it will access devices no longer near system....
so do other application(s) .
|
|
|
|
|
Salvatore Terress wrote: "bluez" (library) is part of the Linux kernel. Well part of it is, which provides the actual kernel interface and drivers. The other part is the user space components which provide for the developer access. More details can be found at BlueZ » About[^]. You cannot bypass the library, since user space code cannot use Kernel features directly.
|
|
|
|
|
I have "upgraded" to Ubuntu 23.04.
"Discovered"it is lacking Bluetooth.
Used this opportunity to test "verify Bluetooth " in my code using "bluetoothctl".
The command responds correctly , but "gets stuck "
in "Waiting to connect to bluetoothd...".
Used same command in "terminal" with same result.
Can somebody suggest similar command or "bluetoothctl"command option (timeout ?)so it does detect lack of Bluetooth, but does not get stuck.
Temporary , I do verify Bluetooth not working by looking for "Agent registered " failure - which is correct response when Bluetooth is OK, actually running. Then if it runs I can "exit" from command.
Help is much appreciated.
Thanks
nov25-1@nov251-desktop:~$ bluetoothctl
Waiting to connect to bluetoothd...
|
|
|
|
|
|
I certainly cannot find a way to change a timeout for it.
Presumably this is your actual situation since it was not clear whether you fixed the first.
1. Bluetooth is not installed
2. You ran the command.
3. It blocks.
Given that then in terms of error detection for a tool you would need to do the following
1. Code something that can run the command asynchronously such as a thread.
2. The caller initiates the call with a timer (that will expire.)
3. If the timer fires a timeout then the tool reports 'bluetooth not found'
4. If the command returns (before the timeout) cancel the timer, then process the results from the command.
|
|
|
|
|
Sorry for delay, had to move my PC and it all broke. Appreciate both suggestions, will use both. While testing, found out that some commands requires "boot access" on "check if enabled" and no "root access" "enable service" -- weird and incontinent.
|
|
|
|
|
Found bluetoothctl --timeout BUT it is not working as expected.
Any idea ?
( Maybe it is not going to work when no bluettoth is NOT running ?)
nov25-1@nov251-desktop:~$ bluetoothctl --timeout
bluetoothctl: option '--timeout' requires an argument
bluetoothctl ver 5.66
Usage:
bluetoothctl [--options] [commands]
Options:
--agent Register agent handler: <capability>
--endpoints Register Media endpoints
--monitor Enable monitor output
--timeout Timeout in seconds for non-interactive mode
--version Display version
--help Display help
nov25-1@nov251-desktop:~$ bluetoothctl --timeout 20
Waiting to connect to bluetoothd...
|
|
|
|
|
That's pretty clear. You need to tell bluetoothctl how long to wait e.g. bluetoothctl --timeout 2 should time out after 2 seconds. Who knows, maybe you could even use a floating point value e.g. --timeout 1.5 for finer grain control.
Normally, though, a long option is specified as --timeout=2 , so you might try that as well if the above does not work. I've checked a few of web sites, but none of them were able to help in this regard. Still a little experimentation on your part should clear that up. When you get it sorted, maybe post a note the to the maintainers that it needs to be explained better.
Keep Calm and Carry On
|
|
|
|