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

pigpiod_if2.c #373

Closed
darkyellow opened this issue Jul 29, 2020 · 6 comments
Closed

pigpiod_if2.c #373

darkyellow opened this issue Jul 29, 2020 · 6 comments

Comments

@darkyellow
Copy link

The code here

int notify_pause(int pi, unsigned handle)
{return pigpio_command(pi, PI_CMD_NB, handle, 0, 1);}

Should it not be PI_CMD_NP rather than PI_CMD_NB?

@guymcswain
Copy link
Collaborator

From just looking at the source you posted, it would seem so. I'll accept a PR if you can test to verify it is indeed broken, fix and retest showing working. Thanks in advance.

@darkyellow
Copy link
Author

unfortunately I am pretty new to the library so just starting out and finding my way around so I don't have any use case to test with. I was just looking through all the functions and noticed the above.

If you see in pigpio.c

case PI_CMD_NP: res = gpioNotifyPause(p[1]); break;

(line 2199)

This can never be called from the remote process because of the mismatch.

@guymcswain
Copy link
Collaborator

If you plan to write some code requiring this, I can add a patch to the development branch. If all's well then it will get picked up in the next release.

@joan2937
Copy link
Owner

joan2937 commented Jul 29, 2020

I think I just decided that since Pause is equivalent to Begin with bits 0 I'd just use Begin. It's the same in the Python. More of an oddity rather than an error.

@darkyellow
Copy link
Author

Thanks, makes sense. I found another

int i2c_process_call(int pi, unsigned handle, unsigned reg, uint32_t val)

and

int i2c_block_process_call(int pi, unsigned handle, unsigned reg, char *buf, unsigned count)

both use PI_CMD_I2CPK and PI_CMD_I2CPC is not used anywhere. I would guess there is similar valid reasoning here too?

@joan2937
Copy link
Owner

joan2937 commented Jul 30, 2020

@darkyellow

No, that is an error. The code for i2c_process_call should be.

int i2c_process_call(int pi, unsigned handle, unsigned reg, uint32_t val)
{
   gpioExtent_t ext[1];

   /*
   p1=handle
   p2=reg
   p3=4
   ## extension ##
   uint32_t val
   */

   ext[0].size = sizeof(uint32_t);
   ext[0].ptr = &val;

   return pigpio_command_ext
      (pi, PI_CMD_I2CPC, handle, reg, 4, 1, ext, 1);
}

In this case Python seems to be using the correct call.

joan2937 added a commit that referenced this issue Aug 17, 2020
guymcswain pushed a commit that referenced this issue Aug 30, 2020
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