Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to specify device to go on or off #1

Open
IAmTheRealGoof opened this issue Sep 28, 2016 · 7 comments
Open

unable to specify device to go on or off #1

IAmTheRealGoof opened this issue Sep 28, 2016 · 7 comments

Comments

@IAmTheRealGoof
Copy link

IAmTheRealGoof commented Sep 28, 2016

It works fine for specifying all devices
$ sudo /usr/local/bin/br -c C --ON

but not when specifying them

$ sudo /usr/local/bin/br -c C --off 1
/usr/local/bin/br: error: [Invalid argument] Bad device number 
/usr/local/bin/br: error: [Invalid argument] Devices must be in the range of [1-16], housecodes [A-P] 
$ sudo /usr/local/bin/br -c C --off=1
/usr/local/bin/br: error: [Invalid argument] Bad device number 
/usr/local/bin/br: error: [Invalid argument] Devices must be in the range of [1-16], housecodes [A-P] 
$ sudo /usr/local/bin/br -c C -f 1
/usr/local/bin/br: error: [Invalid argument] Bad device number 
/usr/local/bin/br: error: [Invalid argument] Devices must be in the range of [1-16], housecodes [A-P] 
$ sudo /usr/local/bin/br -c C --on 1
/usr/local/bin/br: error: [Invalid argument] Bad device number 
/usr/local/bin/br: error: [Invalid argument] Devices must be in the range of [1-16], housecodes [A-P] 
$ sudo /usr/local/bin/br -c C --on 1
/usr/local/bin/br: error: [Invalid argument] Bad device number 
/usr/local/bin/br: error: [Invalid argument] Devices must be in the range of [1-16], housecodes [A-P] 
$ sudo /usr/local/bin/br -c C --on=1
/usr/local/bin/br: error: [Invalid argument] Bad device number 
/usr/local/bin/br: error: [Invalid argument] Devices must be in the range of [1-16], housecodes [A-P] 

And more strangeness if I use -n=1 or -f=1 it act like its working, but doesn't

$ sudo /usr/local/bin/br -c C -f=1 -vvv
/usr/local/bin/br: Opening serial port /dev/firecracker.
/usr/local/bin/br: Executing 1 commands
/usr/local/bin/br: Closing serial port.
/usr/local/bin/br: Cleaning up...

but telling it multiple devices doesnt

$ sudo /usr/local/bin/br -c C -f=1,2,3 -vvv
/usr/local/bin/br: error: [Invalid argument] Bad device number 
/usr/local/bin/br: error: [Invalid argument] Devices must be in the range of [1-16], housecodes [A-P]
sudo /usr/local/bin/br -c C -f 1,2,3 -vvv
/usr/local/bin/br: error: [Invalid argument] Bad device number 
/usr/local/bin/br: error: [Invalid argument] Devices must be in the range of [1-16], housecodes [A-P]

I'm no programmer, havent touched c in about 20 years, but am looking through br_cmd_engine.c , and having it print dev, it's zero.

Oh, and on centos 7.2 on raspberry pi 2 b. and gcc 4.8.5

@linuxha
Copy link
Owner

linuxha commented Oct 13, 2016

Sorry it took me so long to get back to you. How did you compile this? What distribution are you using (Centos, Mint, Unbuntu, Debian, etc).

When I compile this under debian I have no issues with the latest code (I did a git clone of this repos)

@linuxha
Copy link
Owner

linuxha commented Oct 14, 2016

Oh, I should read a bit more ;-)

I added a few fprintf's to my copy of the code and I see this:

$ ./br -c C -f 1,2,3 -vvv
Port = /dev/ttyS0
./br: Opening serial port /dev/ttyS0.
./br: Executing 1 commands
Unit = 32, Cmd = 1
Unit = 33, Cmd = 1
Unit = 34, Cmd = 1
./br: Closing serial port.
./br: Cleaning up...
$

That looks pretty close

@IAmTheRealGoof
Copy link
Author

any chance I get a copy of your changes to compare them?

@linuxha
Copy link
Owner

linuxha commented Nov 9, 2016

On 11/07/2016 08:27 PM, IAmTheRealGoof wrote:

any chance I get a copy of your changes to compare them?

Pretty much it's the most recent code posted to github and these changes:

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)

modified:   br.c
modified:   br_cmd.c

Untracked files:
(use "git add ..." to include in what will be committed)

br

no changes added to commit (use "git add" and/or "git commit -a")

$ git diff br.c
diff --git a/br.c b/br.c
index efa84ac..8c12ad0 100644
--- a/br.c
+++ b/br.c
@@ -650,6 +650,8 @@ int main(int argc, char **argv)
exit(EINVAL);
}

  • fprintf(stderr, "Port = %s\n", port); // njc
  • if ((fd = open_port(cinfo, port)) < 0)
    exit(errno);

$ git diff br_cmd.c
diff --git a/br_cmd.c b/br_cmd.c
index 120dbe1..45c3254 100644
--- a/br_cmd.c
+++ b/br_cmd.c
@@ -274,6 +274,7 @@ int br_cmd(int fd, unsigned char unit, int cmd)
if (cmd > MAX_CMD || cmd < 0)
return -1;

  • fprintf(stderr, "Unit = %d, Cmd = %d\n", unit, cmd);// njc
    /*
  • Make sure to set the numeric part of the device address to 0
  • for dim/bright (they only work per housecode)
    $

Linux Home Automation Neil Cherry ncherry@linuxha.com
http://www.linuxha.com/ Main site
http://linuxha.blogspot.com/ My HA Blog
Author of: Linux Smart Homes For Dummies

@tljohnsn
Copy link

Same problem here, testing on raspberry pi.

@tljohnsn
Copy link

I got it working by reverting to version 0.04c

@linuxha
Copy link
Owner

linuxha commented May 24, 2021

Weird, not sure why this would cause an issue. Unfortunately I no longer have any X10 in my house so I am no long able to test this. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants