Is possible to use the camera controls when capturing a movie? - libgphoto2

I am using my camera as a webcam and I was wondering if it is possible to change things like ISO using the camera controls or even CLI commands when running the following command without stopping "the streamming".
I am running the following command and piping the output to a loopback device
gphoto2 --stdout --capture-movie
If I try to change the ISO using the camera controls it does nothing

Related

Move qemu window output over the network to catch it with another PC

I have an application written in C which uses qemu and its output is continuously displaying itself on the qemu window.
Now what I want is to get this output over the network.
I need some changing in the overall command of qemu. I have read the documentation.
But it is not happening the way I want.

vxWorks kernel shell abilities

I have a car navigation system installed in my car and I figured out that it's running vxWorks 6.9.3.
What I'm trying to achieve is to change some hidden settings of the nav-system.
Small introduction: Nav system have ability to connect to internet via Bluetooth. I setup small web-server the only thing it can do is detect IP address of client. I opened that web-site from head unit browser and detected ip address of head unit. Than I'm able to scan for opened network ports of it.
It turned out that it has 23 port open. And I'm able to telnet there.
It didn't required any password or login and it report operation system info: Windriver vxWorks 6.9.3
I can run various commands here, inspect filesystem, etc.
But I don't know how I can change something. I even found the way to transfer files from USB-key from and to device.
I found that all settings which I want to change are stored in .sqlite files. Some of them are gzipped and have .inf file with check-sums. Algorithm of check-sum calculation is proprietary so I can't transfer .sqlite files from device to usb-key, change something, than gzip and calculate new check-sum.
I think OS can somehow interact with .sqlite files in-memory without ungzip them.
So, is there any ways to open sqlite shell on device using vxWorks kernel shell?
If yes, that would be perfect and enough to achieve anything I want.
If this can't be achieved, can somebody give me some advice of what possibilities I have from vxWorks kernel shell?
The commands available on the VxWorks shell depend on the loaded applications and the kernel itself. From the shell you can call all "public functions" loaded by VxWorks. You enter the function call in a C-like syntax and the shell parses the arguments pushes them onto the stack and jumps to the address of the function just like a normal function call in C.
A helpful function to check if a funtion exists is lkup "foo" which will lists all functions containing "foo" in their name (case sensitive!). But it doesn't tell you anything about the requested parameters. If you are not passing all parameters to the function via the shell, the intepreter pushes some zeroes onto the stack before executing the function call. This may lead to very strange results and may even damage your system (depending on the function)...
If you're able to load a program you may want to use the functions of symLib to iterate all symbols of the VxWorks sysSymTbl.

Transferring file using zmodem/picocom/minicom noninteractively

We are trying to transfer file using minicom (in host pc) and picocom(in arm based evaluation board) combination.
On evaluation board side we have /dev/ttygserial and on host pc side we have /dev/ttyUSB0.
Host side minicom setup is as follows,
Serial device - /dev/ttyUSB0
Baud Rate - 115200
Steps to set minicom in receiving mode.
press ctrl+a R , select zmodem.
Now minicom will start waiting for file from other end.
On evaluation board side we use picocom as follows to send the file.
On command line execute picocom -b 115200 -s "sz -vv" /dev/ttygserial
Now press Ctrl+A and Ctrl+S.
Picocom will ask for filename by printing **file
Once file name is provided and enter is pressed file is sent to host.
All this steps works and we are able to transfer different types of files from evaluation board to pc but now we want to put this procedure into C code. For that I have following doubts,
Is it possible to set minicom in file reception mode using single command? (meaning noninteractively) ?
Is it possible to send file using picocom in single command (meaning noninteractively)?
Any other suggestions?
In other sites also people have asked this kind of question but questions unanswered yet.
So I decided to look into picocom code and found that it is very simple to make a change in that code.
I have made send command non-interactive, I will make receive command too non-interactive and post full code here so that it can be referred by anyone who has a similar problem.

How to render a remote ncurses console?

I wanna write a remote console, working like a telnet server. User is able to use telnet to log into the server, then write some commands to do some works.
A good example for this is the console of router os. What I'm confusing right now is, I can accept user's input, do someting then print some texts back, but I wanna use ncurses to make the console has more features(such as "cmd auto-complete", syntax color...), so how can I do that? Because the console is in user side, if the server calls ncurses APIs it'll just change stuffs on server...
Maybe this is a stupid question but I'm really newbie on this. Any suggestions are appreciated.
This is more difficult than you might think.
You need to understand how terminals work - they use special control sequences for e.g. moving the cursor or color output. This is described by a terminfo file which is terminal-specific. Ncurses translates API calls (e.g. move cursor to a certain position) to such control sequences using terminfo.
Since the terminal (nowadays xterm, gnome-terminal, screen, tmux, etc) is on the client side, you have to pass the type of terminal from the client to the server. That's why e.g. ssh passes this information from the ssh client to the server (try echo $TERM in your ssh session - it might be 'linux' if you are logged in via the console, or 'xterm', if you are using X and an xterm). Also, you better have the respective terminfo available on the server.
Another piece of the puzzle is pseudo terminals. As nowadays relatively few people use serial terminals, their semantics are emulated so that applications and libraries (e.g. curses and its friends) originally developed for serial consoles keep working. This is achieved via pseudo terminals - these are like pipes, a master and a slave device communicates, anything written on one side comes out on the other side. For a login process, getty, for example, can just use one side of a pty device and think it's a serial line - your server program must handle the other side of the pty, sending everything it gets from the pty to your client via the network.
Terminal emulators also use ptys, type tty into your terminal, and you'll get something like /dev/pts/9 if you're using a terminal emulator. On the other side of the pty it's usually your shell, communicating with your terminal emulator via the pty.
Your client program can more or less just use standard input and standard output. If your terminal information is correct, the rest will be handled by your terminal emulator, just pass anything you receive from your server program to stdout, and send anything you read from stdin to your server program.
Hopefully I haven't left out any important detail. Good luck!
It is possible to have ncurses operate on streams other than stdin and stdout. Call newterm() before initscr() to set the input and output file handles for ncurses.
But you will need to know what sort of terminal is on the remote end of the connection (ssh and telnet both have mechanisms for communicating this to the server) and you will also want a fall back to a non-ncurses interface in case the remote end is not a supported terminal type (or if you can't determine the terminal type).

Can't save the output of minicom into a file

When I use Minicom to capture data from a serial port, I need to save the big data into a file, named minicom.cap. However, if I press Ctrl+A and L to capture file, it failed. No file was created (minicom.cap did not exist beforehand). My download directory was properly created. My OS is Mint, and I read data from Arduino nano v3.0
Did you try to start minicom as
minicom -C capturefile
Unless i got something wrong, it should start to capture incoming data immediately.
OP might miss step "Shift + L" after writing, so the overall procedure is as below:
1 (inside minicom)
2 Ctrl A + Z
3 Shift + L
4 (wait for writing ... )
5 Shift + L
6 (check the file you have written, default is minicom.cap, you may want to find it at /root/minicom.cap)
chown root:dialout /etc/minicom/minirc.dfl
chmod 664 /etc/minicom/minirc.dfl
Now any member of the dialout group can write to minirc.dfl
minicom needs a configuration file that is under root permissions and is stored at /etc/minicom/ and is named minirc.dfl.
Usually when you first run minicom for the first time, as sudo, you can save the minirc.dfl, as if you run as any other user it will not save.
That may be your problem.
This is a little more than the scope of the question calls for but as it has already been answered, I thought somebody might like to do things a little user friendly.
You might be interested in this if you frequently open up a serial connection to multiple devices. You can do this with desktop shortcuts.
I use this for switch and router connections, I have two different console cables, a USB to mini USB and also a db9 with USB A adapter to rj45.
Using the shortcuts here means I don't need to manually reconfigure minicom every time I want to switch devices. The shortcuts give the correct configuration file as a parameter (identifier) as well as the capture file (-C). All i need to do it make sure my devices are connected to my computer with the cables.
If this is something you could use, run these commands as a normal user from your terminal (not from minicom). The configuration files will be saved to your home directory where minicom can find them.
Make a log file directory: You might choose to just log in /var/log but I want quick access to the log files.
mkdir ~/minicom
Find your device:
dmesg | grep tty
If your cable uses an RS-232 chip such as some usb to mini usb console cables, your tty device will likely be on ttyACM* and not ttyUSB*
Create the minicom configuration file using nano. Adapt the capitalised parts to fit your needs, baudrate may be set incorrectly if you get quirky characters or no output. You may create as many as you need along with the desktop shortcuts. just change the identifier.
nano ~/.minirc.IDENTIFIER
pu port /dev/ttyDEVICE
pu baudrate 9600
pu rtscts No
pu logfname /home/USER/minicom/IDENTIFIER.log
Create a desktop shortcut.
nano ~/Desktop/IDENTIFIER.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Minicom IDENTIFIER
Comment=Something relevant to your connection/device name maybe
Exec=minicom IDENTIFIER -C/home/USER/minicom/IDENTIFIER.log
Terminal=1
Type=Application
Make it executable
chmod +x ~/Desktop/IDENTIFIER.desktop
That's it now test the connection, double click your new shortcut.
A note about the IDENTIFIER part, it can be anything. a router or switch model, a device name or type. Do what suits you but maybe use hyphens instead of spaces, I've not tested that but i would imagine they would cause issues such as only getting the name before the first space or worse, attempting to load multiple minicom.identifier files.
Once you have created your first connection, open another terminal:
tail -fn25 ~/minicom/IDENTIFIER.log
Because you have set minicom to capture output, by tailing the log/capture file you can scroll back as far as you need should you be running things with lengthy output, It can be useful for configuration files in routers/switches for example which can be thousands of lines long. Just scroll to the part you are working on in the tailed file to use as a reference while you make changes in minicom, the tail terminal will still collect data but will not automatically jump back to the new line as minicom does when you star to type.
If somebody more shell savvy than myself would like to add to this to make a shell script that accepts the required parameters for setting up a new connection profile,logs etc I wouldn't be too upset about it :)
As an aside, I wanted to add a command prior to minicom running in the shortcut to apply a title to the terminal window using the identifier, I could not get this to work in Ubuntu 20.04 at the time of this posting.

Resources