Announcement

Collapse
No announcement yet.

[ANNOUNCE] SqueezeButtonPi - Tool to use buttons and rotary encoders on a RPi

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • paul-
    replied
    Originally posted by PaulH View Post
    - Is there 6 commands (pause, vol up/dn, rew, ffw and power) available ?

    Thanks
    Yes, built in, but there is almost an infinite amount of possibilities with custom configuration files.....its all buried in this thread. But get one thing working correctly so you understand, before moving onto more.

    Leave a comment:


  • Paul Webster
    replied
    sh sbpd-script.sh

    or put a "hash bang" on the first line

    #!/bin/sh

    Also - make sure that you are using Unix line-endings for the file
    If you made all of your edits with nano or vi then you will be ok.
    If you did it with Notepad on Windows then you might have problems.
    If you are using Windows then Notepad++ is the 3rd-party tool to use and tell it to save in Unix format.

    Leave a comment:


  • PaulH
    replied
    Originally posted by chill View Post
    Why? You'll have to explain what's happening now.

    Did you make the script executable?
    Did you test it from the command line?
    I made:
    chmod g+x sbpd-script.sh

    I can't run it:
    Code:
    [email protected]:~$ [email protected]:~$ sbpd-script.sh
    -sh: sbpd-script.sh: not found
    The file exist
    Code:
    [email protected]:~$ ls
    pcp-powerbutton.sh  powerscript.sh      sbpd-script.sh

    Leave a comment:


  • chill
    replied
    Originally posted by PaulH View Post
    But something more is missing.
    Why? You'll have to explain what's happening now.

    Did you make the script executable?
    Did you test it from the command line?

    Leave a comment:


  • PaulH
    replied
    Originally posted by Paul Webster View Post
    You need to set it to run automatically on boot - see the linked posts for how to get pCP to do that for you.
    I look on the post and create file sbpd-script.sh
    Code:
    #start pigpiod daemon
    sudo pigpiod -t 0 -f -l -s 10
    
    # wait for pigpiod to initialize - indicated by 'pigs t' exit code of zero
    count=10 # approx time limit in seconds
    while ! pigs t >/dev/null 2>&1 ; do
            if [ $((count--)) -le 0 ]; then
                    printf "\npigpiod failed to initialize within time limit\n"
                    exit 1 # or however you want to deal with failure
            fi
    #       printf "\nWaiting for pigpiod to initialize\n"
            sleep 1
    done
    printf "\npigpiod is running\n"
    
    # load uinput module - required to be able to send keystrokes
    # then set the permission to group writable, so you don't need to run sbpd with
    sudo modprobe uinput
    sudo chmod g+w /dev/uinput
    
    # issue the sbpd command
    sbpd -s b,8,PLAY,2,0 -v
    And added on the Tweaks User command #1 /home/tc/sbpd-script.sh

    But something more is missing.

    Leave a comment:


  • Paul Webster
    replied
    You need to set it to run automatically on boot - see the linked posts for how to get pCP to do that for you.

    Leave a comment:


  • PaulH
    replied
    Originally posted by paul- View Post
    Then tell it to use pin 8, it’s all in the help information.

    Code:
    For buttons: 
        b,pin,CMD[,resist,pressed,CMD_LONG,long_time]
            "b" for "Button"
            pin: GPIO PIN numbers in BCM-notation
    Almost nothing uses physical PIN numbers.
    It work!!! I used physical pin numbers! :-(

    But when I quit (CTRL C) the terminal, the switch doesn't work anymore.
    How to "stay" it working ?

    - Is there 6 commands (pause, vol up/dn, rew, ffw and power) available ?

    Thanks

    Leave a comment:


  • chill
    replied
    What command line options did you use with pigpiod?
    Do you have any other devices attached to this RPi?

    Leave a comment:


  • paul-
    replied
    Then tell it to use pin 8, it’s all in the help information.

    Code:
    For buttons: 
        b,pin,CMD[,resist,pressed,CMD_LONG,long_time]
            "b" for "Button"
            pin: GPIO PIN numbers in BCM-notation
    Almost nothing uses physical PIN numbers.

    Leave a comment:


  • PaulH
    replied
    Originally posted by Paul Webster View Post
    "Could not connect to pigpiod. Is it running?"

    This does not look good.
    Is it running?

    ps -ef | grep pigpiod
    Code:
    [email protected]:~$ ps -ef | grep pigpiod
    10897 root      0:06 pigpiod
    10920 tc        0:00 grep pigpiod
    Code:
    [email protected]:~$ sbpd -s b,24,PLAY,2,0 -v
    1642946028.5591 6 sbpd.c,316: Options parsing: Set verbose mode
    1642946028.5594 6 sbpd.c,505: Using builtin button configuration
    1642946028.5595 6 control.c,108: Adding Command PLAY: Fragment ["pause"]
    1642946028.5595 6 control.c,108: Adding Command VOL+: Fragment ["button","volup"]
    1642946028.5596 6 control.c,108: Adding Command VOL-: Fragment ["button","voldown"]
    1642946028.5596 6 control.c,108: Adding Command PREV: Fragment ["button","rew"]
    1642946028.5596 6 control.c,108: Adding Command NEXT: Fragment ["button","fwd"]
    1642946028.5597 6 control.c,108: Adding Command POWR: Fragment ["button","power"]
    1642946028.5597 6 GPIO.c,312: Initializing GPIO
    1642946028.5631 6 control.c,262: Button defined: Pin 24, BCM Resistor: up, Short Type: LMS, Short Fragment: ["pause"] , Long Type: unused, Long Fragment: (null), Long Press Time: 3000
    1642946028.5633 6 discovery.c,385: MAC address found: dc:a6:32:75:45:0a
    1642946028.5634 6 servercomm.c,176: Initializing CURL
    1642946028.5692 6 sbpd.c,264: Starting main loop polling
    1642946028.5700 6 discovery.c,238: Found server 7801A8C0. A new address
    1642946028.5710 6 discovery.c,349: discovery packet: port: 9000, name: pCP, uuid: 91de9a84-351e-488d-94ea-501fb32b7249
    1642946028.5711 6 discovery.c,130: Squeezebox control port found: 9000
    1642946028.5712 6 discovery.c,149: Server address found: 192.168.1.120
    But nothing happens when PIN24 (GPIO8) goes to GND
    Last edited by PaulH; 2022-01-23, 13:56.

    Leave a comment:


  • chill
    replied
    You have to start the pigpio daemon manually before running sbpd. See this post for an example script.

    Leave a comment:


  • Paul Webster
    replied
    "Could not connect to pigpiod. Is it running?"

    This does not look good.
    Is it running?

    ps -ef | grep pigpiod

    Leave a comment:


  • PaulH
    replied
    Originally posted by Paul Webster View Post
    No

    You do it all from the pCP web interface - look for "Extensions".


    Note though ... pCP is not like other Linux systems.
    It is great for novices to get going really quickly.
    Part of its speed in booting is its small size and being memory resident.

    However, if you want to do something that it does not handle already then it can be harder to do then you would expect from a generic How To guide that is aimed at Rasbian or Raspberry Pi OS ... as you are finding out.

    You might be better off using a full Linux and then following a generic guide for installing LMS and Squeezelite ... then you can more easily add other things where you follow a generic guide.
    I did everything with Termina!!!!
    Now I used Extensions!

    It seems better but not working:

    Code:
    [email protected]:~$ sbpd -s b,24,PLAY,2,0 -v
    1642942772.8382 6 sbpd.c,316: Options parsing: Set verbose mode
    1642942772.8389 6 sbpd.c,505: Using builtin button configuration
    1642942772.8389 6 control.c,108: Adding Command PLAY: Fragment ["pause"]
    1642942772.8392 6 control.c,108: Adding Command VOL+: Fragment ["button","volup"]
    1642942772.8394 6 control.c,108: Adding Command VOL-: Fragment ["button","voldown"]
    1642942772.8395 6 control.c,108: Adding Command PREV: Fragment ["button","rew"]
    1642942772.8397 6 control.c,108: Adding Command NEXT: Fragment ["button","fwd"]
    1642942772.8398 6 control.c,108: Adding Command POWR: Fragment ["button","power"]
    1642942772.8400 6 GPIO.c,312: Initializing GPIO
    1642942772.8421 3 sbpd.c,202: Could not connect to pigpiod. Is it running?
    [email protected]:~$ sbpd -d -s b,24,PLAY,2,0 -v 
    1642942852.7376 6 sbpd.c,316: Options parsing: Set verbose mode
    1642942852.7378 6 sbpd.c,505: Using builtin button configuration
    1642942852.7379 6 control.c,108: Adding Command PLAY: Fragment ["pause"]
    1642942852.7379 6 control.c,108: Adding Command VOL+: Fragment ["button","volup"]
    1642942852.7380 6 control.c,108: Adding Command VOL-: Fragment ["button","voldown"]
    1642942852.7380 6 control.c,108: Adding Command PREV: Fragment ["button","rew"]
    1642942852.7380 6 control.c,108: Adding Command NEXT: Fragment ["button","fwd"]
    1642942852.7381 6 control.c,108: Adding Command POWR: Fragment ["button","power"]

    Leave a comment:


  • Paul Webster
    replied
    No

    You do it all from the pCP web interface - look for "Extensions".


    Note though ... pCP is not like other Linux systems.
    It is great for novices to get going really quickly.
    Part of its speed in booting is its small size and being memory resident.

    However, if you want to do something that it does not handle already then it can be harder to do then you would expect from a generic How To guide that is aimed at Rasbian or Raspberry Pi OS ... as you are finding out.

    You might be better off using a full Linux and then following a generic guide for installing LMS and Squeezelite ... then you can more easily add other things where you follow a generic guide.

    Leave a comment:


  • PaulH
    replied
    Originally posted by paul- View Post
    That is many years old.

    The only extension you need to load is pcp-sbpd.tcz from our repo.
    Is it the right place ? Thanks

    [email protected]:~$ wget http://picoreplayer.sourceforge.net/...z/pcp-sbpd.tcz
    Connecting to picoreplayer.sourceforge.net (204.68.111.100:80)
    saving to 'pcp-sbpd.tcz'
    pcp-sbpd.tcz 100% |************************************************* ***************| 192k 0:00:00 ETA
    'pcp-sbpd.tcz' saved
    [email protected]:~$ sbpd -s b,24,PLAY,2,0 -v
    1642930181.4635 6 GPIO.c,219: Initializing GPIO
    Unable to determine hardware version. I see: Hardware : BCM2711
    ,
    - expecting BCM2708, BCM2709 or BCM2835.
    If this is a genuine Raspberry Pi then please report this
    to [email protected]. If this is not a Raspberry Pi then you
    are on your own as wiringPi is designed to support the
    Raspberry Pi ONLY.
    [email protected]:~$

    Leave a comment:

Working...
X