[Libusbx-devel] [PATCH] Fix example hotplug code in comment to make it compile and work

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Libusbx-devel] [PATCH] Fix example hotplug code in comment to make it compile and work

Markus Heidelberg
Also add #include directives since this is a complete program including
main().
---

I'm not sure about the #include directives. If not desired, they can be
discarded along with the corresponding sentence in the patch description.

 libusb/hotplug.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libusb/hotplug.c b/libusb/hotplug.c
index 081bc79..e86c1cb 100644
--- a/libusb/hotplug.c
+++ b/libusb/hotplug.c
@@ -86,6 +86,11 @@
  *
  * The following code provides an example of the usage of the hotplug interface:
 \code
+#include <libusb.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
 static int count = 0;
 
 int hotplug_callback(struct libusb_context *ctx, struct libusb_device *dev,
@@ -131,10 +136,11 @@ int main (void) {
   }
 
   while (count < 2) {
+    libusb_handle_events_completed(NULL, NULL);
     usleep(10000);
   }
 
-  libusb_hotplug_deregister_callback(handle);
+  libusb_hotplug_deregister_callback(NULL, handle);
   libusb_exit(NULL);
 
   return 0;
--
1.8.5.2


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [PATCH] Fix example hotplug code in comment to make it compile and work

Ludovic Rousseau
Hello,

Now the merge is on a good track it may be time to fix minor things
like the documentation as proposed in this "old" patch.
Or should we wait after the 1.0.18 is released?

Bye

2013/12/20 Markus Heidelberg <[hidden email]>:

> Also add #include directives since this is a complete program including
> main().
> ---
>
> I'm not sure about the #include directives. If not desired, they can be
> discarded along with the corresponding sentence in the patch description.
>
>  libusb/hotplug.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/libusb/hotplug.c b/libusb/hotplug.c
> index 081bc79..e86c1cb 100644
> --- a/libusb/hotplug.c
> +++ b/libusb/hotplug.c
> @@ -86,6 +86,11 @@
>   *
>   * The following code provides an example of the usage of the hotplug interface:
>  \code
> +#include <libusb.h>
> +#include <stdlib.h>
> +#include <stdio.h>
> +#include <unistd.h>
> +
>  static int count = 0;
>
>  int hotplug_callback(struct libusb_context *ctx, struct libusb_device *dev,
> @@ -131,10 +136,11 @@ int main (void) {
>    }
>
>    while (count < 2) {
> +    libusb_handle_events_completed(NULL, NULL);
>      usleep(10000);
>    }
>
> -  libusb_hotplug_deregister_callback(handle);
> +  libusb_hotplug_deregister_callback(NULL, handle);
>    libusb_exit(NULL);
>
>    return 0;
> --
> 1.8.5.2
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> libusbx-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/libusbx-devel



--
 Dr. Ludovic Rousseau

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [PATCH] Fix example hotplug code in comment to make it compile and work

Pete Batard

Unless we find something critical, I STRONGLY vote to delay it until after 1.0.18, even if it's doc.

As Murphy's day (yesterday) taught me, if there's anything that can go wrong when duplicating work, it will go wrong. The github sudden breakage [1], which you are aware of, and which thankfully happened before we went live, was only the tip of the iceberg (for instance, the machine I used to upload the doc from has no working doxygen right now...).

If something's gotta break, I'd rather have it break when there's only a single release being pushed out... ;)

Of course, anything that looks critical is go (and right now I'm wondering if the infinite loop fix that was just submitted qualifies)...

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [PATCH] Fix example hotplug code in comment to make it compile and work

Ludovic Rousseau
In reply to this post by Markus Heidelberg
2013-12-20 Markus Heidelberg <[hidden email]>:

> Also add #include directives since this is a complete program including
> main().
> ---
>
> I'm not sure about the #include directives. If not desired, they can be
> discarded along with the corresponding sentence in the patch description.
>
>  libusb/hotplug.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/libusb/hotplug.c b/libusb/hotplug.c
> index 081bc79..e86c1cb 100644
> --- a/libusb/hotplug.c
> +++ b/libusb/hotplug.c
> @@ -86,6 +86,11 @@
>   *
>   * The following code provides an example of the usage of the hotplug interface:
>  \code
> +#include <libusb.h>
> +#include <stdlib.h>
> +#include <stdio.h>
> +#include <unistd.h>
> +
>  static int count = 0;
>
>  int hotplug_callback(struct libusb_context *ctx, struct libusb_device *dev,
> @@ -131,10 +136,11 @@ int main (void) {
>    }
>
>    while (count < 2) {
> +    libusb_handle_events_completed(NULL, NULL);
>      usleep(10000);
>    }
>
> -  libusb_hotplug_deregister_callback(handle);
> +  libusb_hotplug_deregister_callback(NULL, handle);
>    libusb_exit(NULL);
>
>    return 0;
> --
> 1.8.5.2

Patch applied in
https://github.com/libusb/libusb/commit/93de199d8d60822fc42b1cbf8b920132cd8bbbc6

Thanks

--
 Dr. Ludovic Rousseau

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Loading...