You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a PHP application which uses piphp. This worked fine on a Raspberry 4. However, after migrating to Raspberry 5, I get the exception: fwrite(): Write of 2 bytes failed with errno=22:
1. in /var/www/basic/vendor/piphp/gpio/src/FileSystem/FileSystem.phpat line 55
46474849505152535455565758596061626364
$this->exceptionIfFalse($bytesWritten, $extra);
return $bytesWritten;
}
private function exceptionIfFalse($result, $extra = '')
{
if (false === $result) {
$errorDetails = error_get_last();
throw new RuntimeException($errorDetails['message'].' '.$extra);
}
}
/**
* {@inheritdoc}
*/
public function exists($path)
{
return file_exists($path);
2. in /var/www/basic/vendor/piphp/gpio/src/FileSystem/FileSystem.php at line 46– PiPHP\GPIO\FileSystem\FileSystem::exceptionIfFalse()
40414243444546474849505152
{
$stream = $this->open($path, 'w');
$bytesWritten = @fwrite($stream, $buffer);
fclose($stream);
$extra = $path.' '.$buffer;
$this->exceptionIfFalse($bytesWritten, $extra);
return $bytesWritten;
}
private function exceptionIfFalse($result, $extra = '')
{
3. in /var/www/basic/vendor/piphp/gpio/src/Pin/Pin.php at line 166– PiPHP\GPIO\FileSystem\FileSystem::putContents()
160161162163164165166167168
*
* @param string $file The file to write to
*/
private function writePinNumberToFile($file)
{
//echo "file is $file";
$this->fileSystem->putContents($file, $this->getNumber());
}
}
4. in /var/www/basic/vendor/piphp/gpio/src/Pin/Pin.php at line 62– PiPHP\GPIO\Pin\Pin::writePinNumberToFile()
56575859606162636465666768 */
public function export()
{
if (!$this->isExported()) {
$this->exported = true;
$this->writePinNumberToFile($this->getFile(self::GPIO_FILE_EXPORT));
// After export, we need to wait some time for kernel to report changes.
usleep(200 * 1000);
}
}
Debugging shows that the $file = /sys/class/gpio/export and the $buffer = 16. Both seem totally fine to me....
My user (www-data) is in the gpio group (and in the root group). So I believe that file-permissions are not the issue.
Looking around on the internet, it appears that fwrite() errno 22 is caused by writing too much data to a file. That does not seem applicable here, as /sys/class/gpio/export seems to be an emulated file (Is that right? I am not sure).
The text was updated successfully, but these errors were encountered:
Hi @forenkema ! Same problem here, I did upgrade my raspberry, and that seems to be the problem. I'm installing right now and older versiones of the kernel.
Maybe I'm mistaken but after hours of searching and little help from ChatGPT could be related with the Legacy gpio_sysfs , and uses the libgpiod.
But until I can install everything on a new card. It's only an asumption.
I have a PHP application which uses piphp. This worked fine on a Raspberry 4. However, after migrating to Raspberry 5, I get the exception: fwrite(): Write of 2 bytes failed with errno=22:
Debugging shows that the $file = /sys/class/gpio/export and the $buffer = 16. Both seem totally fine to me....
My user (www-data) is in the gpio group (and in the root group). So I believe that file-permissions are not the issue.
Looking around on the internet, it appears that fwrite() errno 22 is caused by writing too much data to a file. That does not seem applicable here, as /sys/class/gpio/export seems to be an emulated file (Is that right? I am not sure).
The text was updated successfully, but these errors were encountered: