Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Added docs about WIRINGPI_CODES environment variable #37

Merged
merged 1 commit into from
Apr 25, 2018

Conversation

anmenaga
Copy link
Contributor

WiringPi library has a default behavior of terminating current process (e.g. PowerShell) even on non-critical errors in setup functions. For example:

pwsh will crash and throw the error Unable to select I2C device: Device or resource busy.

Get-I2CDevice -Id 911 #Or some other value that isn't valid
# pwsh will crash, throwing the error Unable to select I2C device: Invalid argument.

This PR adds doc instructions on how to avoid such crashes.

@TylerLeonhardt
Copy link
Member

@anmenaga Did you try this:

[Environment]::SetEnvironmentVariable("WIRINGPI_CODES", "1", "Process")

Notice the Process scope.

https://msdn.microsoft.com/en-us/library/96xafkes(v=vs.110).aspx

@tomlarse
Copy link

This is probably related to #29 I guess?

@TylerLeonhardt
Copy link
Member

@tomlarse indeed

@TylerLeonhardt
Copy link
Member

Oops :)

@anmenaga
Copy link
Contributor Author

anmenaga commented Apr 25, 2018

@tylerl0706 Tried that, but it has no effect - wiringPi not picking it up.
By the way, RaspberryIO library already has this line in its Initialize code, but no effect; I think I saw an issue on CoreCLR github about this.

@TylerLeonhardt
Copy link
Member

So strange...

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@anmenaga anmenaga merged commit 325fff0 into PowerShell:master Apr 25, 2018
@DanielSSilva
Copy link
Contributor

DanielSSilva commented May 6, 2018

Even with this flag, this is still crashing with
*** Error in `pwsh': free(): invalid pointer: 0x76c82694 ***

:( The worst part is that I can't understand when/why

@TylerLeonhardt
Copy link
Member

@DanielSSilva can you add the code that's crashing here?

@DanielSSilva
Copy link
Contributor

https://gist.github.com/DanielSSilva/ea2d5ddbaffa1ff5576622ea4543badd

It's easier to see here. Like I've said, it does not crash everytime...

@anmenaga
Copy link
Contributor Author

anmenaga commented May 7, 2018

@DanielSSilva This error is a signature of issue #29 .
In short, there is a bug in error-handling routines of Unosquare.RaspberryIO library.
WIRINGPI_CODES flag won't help with this; we actually need to fix RaspberryIO code.

@DanielSSilva please add your link to the issue #29 . It will help to keep everything related to this problem in one place. Thank you.

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

Successfully merging this pull request may close these issues.

4 participants