I have recently gotten a raspberry pi, and have decide to not use a Desktop Environment. I have QT, and other development packages installed, however without QT-Embedded, I can't use the virtual windowing tools that QT Comes with. I wanted to create a media center style PC without the fancy additions of XBMC and other media centers. As I don't have a DE/Window system I can't run anything with a gui. I wanted to make a system that would allow me to run/play movies on the pi from any of my devices (Phone, Tablet, Desktop). So I have decided to make a GUI/Server on my computer that would control the PI via TCP. I would use PHP for a web system that would create trigger files that a FileSystemWatcher would pick up for the mobile devices, and will use a direct C# gui on the desktop.
I can do this with no problem as it is done with a standard TCP Connection. I will send commands such as: ~MSFS; to Mount the Shared file system (if not done), ~PV;FileName to Play the Video using omxplayer. All of this is pretty easy and as I will drive everything from the desktop it isn't a lot of pi side stuff to do. Now the problem is.. by forking the process I lose the direct input into the program, and as I will be running it externally instead of on the device I don't get the direct CLI input. As it is all command line, I pause videos by pressing "p". I am sure there are other commands I just haven't looked into them.
The Need:
As I will be controlling it from the PC Server I want to have the ability to send commands such as ~PAUSE; or equivelant, from the desktop to the pi, and have it send the 'p' key to the omxplayer. I have read about using pipes to communicate between parent a child processes, however as I am not taking input via command line for this it would be done all internally during the TCP Packet processing, I don't know how to get that stream. In C# it would just be a memorystream or stock stream that I could just save off and call good. I am not sure if I can do that with the pipe. Now, pausing is just an example, however having the ability to pause a video is a good thing, and would really be a requirement in making it useful.
TLDR;
I am making a client/server program for my Raspberry PI, that will run a child process. I need to send a specific key to the child process when a specific packet is sent. ie) Server Sends ~PAUSE, Client Processes and sends the "p" key to the child process, which then should pause the video (as that's how it works when I run the program directly, hitting p will pause it). How do I do it?
You pay just $100 per TB with this rare 4TB PCIe Gen4 NVMe SSD deal by Sayan Sen SSDs and GPUs are incredibly hard to get nowadays due to high pricing. Discounts are quite rare which is why we report on them as soon as we spot a good deal. For example AMD's new 9070 GRE was finally up for sale at a very good price of just $500 thanks to a special coupon. Sadly that deal is gone but if you happen to be looking for a 4TB NVMe SSD and can spend around $400 there is a really good offer on sale that you should not miss out on as TeamGroup's 4TB G50 model is on sale for that that price which means you are only paying $100 per TB, a very good deal in the current market (purchase link under the specs table down below).
The TeamGroup T-FORCE G50 NVMe SSD is a PCIe Gen4 drive and as such it promises to deliver sequential read speeds of up to 5,000 MB/s, helping accelerate game loading, file transfers, and everyday computing tasks. Since this is a 4TB drive you can use it for a gaming library to take advantage of things like DirectStorage.
The SSD features an InnoGrit controller and SLC caching technology to support consistent performance. An ultra-thin, patented graphene heatsink is included to aid in heat dissipation.
Get it at the link below:
Team Group T-FORCE G50 4TB Internal SSD (TM8FFE004T0C129): $449.99 + $50 off w/ promo code SSF69668, limited offer => $39.99 (Sold and Shipped by Newegg US)
Good to know
This Amazon deal is U.S. specific, and not available in other regions unless specified.
We only use first-party seller links (at the time of article publishing); ensure that you purchase from a first-party seller link only.
Check out Today's Deals on Amazon | or our recent tech deals.
Become a Prime member (for Students or SNAP) via Neowin
Get Prime Access - Prime for half price (for qualifying Medicaid, EBT, SNAP)
Subscribe to Prime Video, Audible Plus, Music Unlimited or Kindle Unlimited via Neowin
As an Amazon Associate, we earn from qualifying purchases.
I agree. I also think Phil stayed too long. They should definitely fire whoever thought all a console platform needed was Call of Duty, Elder Scrolls, and Fallout to survive. Asha and crew are still saying they need more Elder Scrolls and Fallout games. They simply don't get it.
Question
firey
Background/Description:
I have recently gotten a raspberry pi, and have decide to not use a Desktop Environment. I have QT, and other development packages installed, however without QT-Embedded, I can't use the virtual windowing tools that QT Comes with. I wanted to create a media center style PC without the fancy additions of XBMC and other media centers. As I don't have a DE/Window system I can't run anything with a gui. I wanted to make a system that would allow me to run/play movies on the pi from any of my devices (Phone, Tablet, Desktop). So I have decided to make a GUI/Server on my computer that would control the PI via TCP. I would use PHP for a web system that would create trigger files that a FileSystemWatcher would pick up for the mobile devices, and will use a direct C# gui on the desktop.
I can do this with no problem as it is done with a standard TCP Connection. I will send commands such as: ~MSFS; to Mount the Shared file system (if not done), ~PV;FileName to Play the Video using omxplayer. All of this is pretty easy and as I will drive everything from the desktop it isn't a lot of pi side stuff to do. Now the problem is.. by forking the process I lose the direct input into the program, and as I will be running it externally instead of on the device I don't get the direct CLI input. As it is all command line, I pause videos by pressing "p". I am sure there are other commands I just haven't looked into them.
The Need:
As I will be controlling it from the PC Server I want to have the ability to send commands such as ~PAUSE; or equivelant, from the desktop to the pi, and have it send the 'p' key to the omxplayer. I have read about using pipes to communicate between parent a child processes, however as I am not taking input via command line for this it would be done all internally during the TCP Packet processing, I don't know how to get that stream. In C# it would just be a memorystream or stock stream that I could just save off and call good. I am not sure if I can do that with the pipe. Now, pausing is just an example, however having the ability to pause a video is a good thing, and would really be a requirement in making it useful.
TLDR;
I am making a client/server program for my Raspberry PI, that will run a child process. I need to send a specific key to the child process when a specific packet is sent. ie) Server Sends ~PAUSE, Client Processes and sends the "p" key to the child process, which then should pause the video (as that's how it works when I run the program directly, hitting p will pause it). How do I do it?
Link to comment
https://www.neowin.net/forum/topic/1123316-c-send-keypresscode-to-a-child-process/Share on other sites
2 answers to this question
Recommended Posts