Skip to content

Commit 9d18a9c

Browse files
committed
Updates
1 parent 4f1e693 commit 9d18a9c

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Flat3\RevPi\Hardware\Local;
6+
7+
use Flat3\RevPi\Interfaces\Hardware\Stream;
8+
9+
class LocalCharacterDevice extends LocalDevice implements Stream
10+
{
11+
public function fdopen(): mixed
12+
{
13+
$stream = fopen("php://fd/{$this->fd}", 'r+b');
14+
assert($stream !== false);
15+
stream_set_blocking($stream, false);
16+
17+
return $stream;
18+
}
19+
}

src/Hardware/Local/LocalDevice.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,4 @@ public function ioctl(int $request, ?string &$argp = null): int
104104

105105
return $ret;
106106
}
107-
108-
public function fdopen(): mixed
109-
{
110-
$stream = fopen("php://fd/{$this->fd}", 'r+b');
111-
assert($stream !== false);
112-
stream_set_blocking($stream, false);
113-
114-
return $stream;
115-
}
116107
}

src/Hardware/Local/LocalTerminalDevice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use FFI;
88
use Flat3\RevPi\Interfaces\Hardware\Terminal;
99

10-
class LocalTerminalDevice extends LocalDevice implements Terminal
10+
class LocalTerminalDevice extends LocalCharacterDevice implements Terminal
1111
{
1212
public function cfsetispeed(string &$buffer, int $speed): int
1313
{

0 commit comments

Comments
 (0)