Using USB remote to control chdkptp with Raspberry Pi - page 4 - Hello, I'm a NEWBIE - HELP!! (Newbies assistance, User Guides and thank you notes) - CHDK Forum  

Using USB remote to control chdkptp with Raspberry Pi

  • 68 Replies
  • 24481 Views
*

Online reyalp

  • ******
  • 13674
Re: Remotely start/stop recording and Zoom control question!
« Reply #30 on: 30 / March / 2017, 16:14:28 »
Advertisements
I guess after realizing that a USB remote would be perfect for this project, my thought was having the Pi autostart the chdkptp's cli and to write a program (would I need to write a Lua script for this?..)
You would only need to use Lua if you want to run the code inside chdkptp. If you are more comfortable with some other language or scripting environment, it probably makes more sense to use that and control chdkptp with one of the other options I mentioned. What makes the most sense will also depend on what kind of input your remote produces.
Quote
that reads a specific USB button press and writes out a command to chdkptp. reyalp, you make it seem like this is a possibility... I'm just going to have to research how exactly to do this. Know of any good Raspberry Pi forums/websites that could help me out with this question?
I don't spend much time in any pi forums, but the official one has a section for projects and seems pretty active https://www.raspberrypi.org/forums/
Don't forget what the H stands for.

Re: Remotely start/stop recording and Zoom control question!
« Reply #31 on: 03 / April / 2017, 13:42:15 »
Alright, I have another chdkptp question before I start figuring out some specific RPi questions...

So I have familiarized myself with the GUI, and it's great to visualize what I am doing... but now I need to figure out how to do everything with no GUI... so  I was wondering if someone could let me know how I can start the use of chdkptp via the command line on the Pi. How exactly do I get things up and running without the GUI?

*

Online reyalp

  • ******
  • 13674
Re: Remotely start/stop recording and Zoom control question!
« Reply #32 on: 03 / April / 2017, 16:21:51 »
How exactly do I get things up and running without the GUI?
I'm not clear what the question is. You run chdkptp.sh instead of chdkptp_gui.sh (or on windows, start with any command line option other than -g), and either type commands interactively, or specify everything on the command line.

For information about the syntax and commands available see
https://app.assembla.com/spaces/chdkptp/wiki/CLI_Quickstart and the included USAGE.TXT

If you there is something specific you aren't sure how to do with the CLI, please give a little more detail.
Don't forget what the H stands for.

Re: Remotely start/stop recording and Zoom control question!
« Reply #33 on: 04 / April / 2017, 12:43:53 »
For information about the syntax and commands available see
https://app.assembla.com/spaces/chdkptp/wiki/CLI_Quickstart and the included USAGE.TXT

Sorry, got lazy for a second there. That is exactly what I was looking for. Thanks!


Using USB remote to control chdkptp with Raspberry Pi
« Reply #34 on: 05 / April / 2017, 16:08:10 »
Hey all,

I made a post in the past that asked a certain question, but with all of the answers and help given to me, my main question sort of changed:

https://chdk.setepontos.com/index.php?topic=13062.0

To clean things up for myself, I wanted to start another post and see if I could maybe get some more specific answers and guidance. I am both a newbie with chdk and using the Raspberry Pi. So if you have a lot of knowledge with Raspberry Pi programming, that would be great. The Pi forums haven't proved that helpful to me.

Anyways, I have the chdkptp set up on my Raspberry Pi and I can connect to the Pi using VNC viewer to view the GUI, and remotely control my Canon A4000IS easily through there... but I want to take it one step further. I want to be able to plug in a remote (someone suggested a USB infrared remote that is similar to what you would use for a project presentation), and depending on what button I press on the remote, I would like the Pi to send a command to the chdkptp.sh.

This has a lot more to do with Raspberry Pi programming than using CHDK, but I was hoping that changing the title to my post would get some fresh eyes on my question.

Thank you for you help!

*

Online reyalp

  • ******
  • 13674
Re: Using USB remote to control chdkptp with Raspberry Pi
« Reply #35 on: 05 / April / 2017, 17:44:55 »
Quote
This has a lot more to do with Raspberry Pi programming than using CHDK, but I was hoping that changing the title to my post would get some fresh eyes on my question.
FWIW, there's only a handful of regulars in this forum, so posting a in a different thread is unlikely to get you more/better answers.

We generally find it works better to just have one thread for each persons project and let the discussion wander where it will, so I will merge this with the previous one.

Regarding you post, it's unlikely you'll get much useful input here without specific questions. This is likely true on other forums as well.

I'm certain many people must have used a raspberry pi with remote controls of various sorts, so google is very a likely a good place to start. The second result I got for raspberry pi remote control was https://www.htpcbeginner.com/simple-cheap-raspberry-pi-remote-control/

The xmbc / home theater stuff doesn't apply, but writing a script that takes key presses and generates chdkptp commands should not be a big deal. For $5, my suggestion would be to just buy one and start tinkering.
Don't forget what the H stands for.

Re: Using USB remote to control chdkptp with Raspberry Pi
« Reply #36 on: 05 / April / 2017, 17:59:56 »
The xmbc / home theater stuff doesn't apply, but writing a script that takes key presses and generates chdkptp commands should not be a big deal. For $5, my suggestion would be to just buy one and start tinkering.

I guess I overestimated how many people are on this forum, haha. My apologies. Thank you for merging the two posts. But okay, I can start tinkering with that remote.

I do have a specific question for you: where do I get started on writing a script that takes button presses and generates chdkptp commands? Would this have to be a Lua script?

EDIT: Sorry if I'm asking a lot on this forum, but if this needs some Lua scripting, I would love as many helping hands as possible. I have looked through a lot of the chdk website and even though I have seen the Lua scripting stuff, I may need extra assistance on starting this!
« Last Edit: 05 / April / 2017, 18:05:27 by smartzer »

Re: Using USB remote to control chdkptp with Raspberry Pi
« Reply #37 on: 05 / April / 2017, 18:37:31 »
[I do have a specific question for you: where do I get started on writing a script that takes button presses and generates chdkptp commands? Would this have to be a Lua script?
Well, your raspberry-pi supports just about every scripting language currently in popular use, and a bunch of obscure ones.   Bash, perl, python, etc

All you need is something that can wait for a character from a USB port that then launch chdkptp with appropriate command line parameters.   And just about any scripting language should be able to handle that. 

But being even too lazy to do that, when I did my raspberry pi  / chdkptp photobooth application I just glued it all together with a plain old compiled C program.

It's pretty much up to you.

Update : a short bit of googling for " raspberry pi script to read USB mouse input" finds 19 pages of hits.  Here's a couple of examples  :

https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=42046
http://positon.org/listen-to-mouse-events-in-linux-text-mode
« Last Edit: 05 / April / 2017, 18:44:39 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline srsa_4c

  • ******
  • 4447
Re: Using USB remote to control chdkptp with Raspberry Pi
« Reply #38 on: 05 / April / 2017, 18:52:54 »
FWIW, doing an internet search for
raspberry pi lirc
can also be useful.

*

Online reyalp

  • ******
  • 13674
Re: Using USB remote to control chdkptp with Raspberry Pi
« Reply #39 on: 05 / April / 2017, 23:07:52 »
I do have a specific question for you: where do I get started on writing a script that takes button presses and generates chdkptp commands?
First, you need to figure what kind of input your remote generates: keyboard key presses, mouse emulation, or something else.

Then you have to write a program reads that input, and does something in response to it. Sorry this is vague, but it depends on how you are getting the input and what language you are using. Normally in linux, keyboard and mouse input are filtered through a terminal or GUI session, so getting the input in an easy to use form may be tricky. But again, a lot of people using raspberry pi have dealt with this, so google will be your friend.

Once you have that working, make the "do something in response" be either executing chdkptp with a specific commend, like

chdkptp.sh -c -e "=click('zoom_in')"

or write output that is piped into chdkptp, so for example you start your program like

remote_program | chdkptp.sh

and then when your program sees the zoom button, it outputs something like

=click('zoom_in')

Quote
Would this have to be a Lua script?
No, any language that can either write to standard output or execute other programs would be fine. If whatever your remote generates is easily read from Lua in chdkptp, that could save you writing separate program and add some flexibility, but the non-GUI can normally only read line oriented input from stdin. (The GUI can get key and mouse events using regular IUP code http://webserver2.tecgraf.puc-rio.br/iup/)

Actually controlling the camera requires you send Lua code from chdkptp, like using the = command as in the examples above.
Don't forget what the H stands for.

 

Related Topics