diff --git a/py/stream.c b/py/stream.c
index 1361d6c72226d41bb5fc1a65d1787bbb6fb6a9a1..810e9b3498567f62e1b88aa7df4028ad0daea0ab 100644
--- a/py/stream.c
+++ b/py/stream.c
@@ -382,7 +382,7 @@ mp_obj_t mp_stream_unbuffered_iter(mp_obj_t self) {
 
 STATIC mp_obj_t stream_seek(mp_uint_t n_args, const mp_obj_t *args) {
     struct _mp_obj_base_t *o = (struct _mp_obj_base_t *)args[0];
-    if (o->type->stream_p == NULL || o->type->stream_p->read == NULL) {
+    if (o->type->stream_p == NULL || o->type->stream_p->ioctl == NULL) {
         // CPython: io.UnsupportedOperation, OSError subclass
         nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "Operation not supported"));
     }
diff --git a/stmhal/file.c b/stmhal/file.c
index 8e42bda5781d28ed68473d1a9074a5ad2d169d6a..c4f4dace0dc8bf1c05717b40064abea631da837b 100644
--- a/stmhal/file.c
+++ b/stmhal/file.c
@@ -260,6 +260,7 @@ const mp_obj_type_t mp_type_fileio = {
 STATIC const mp_stream_p_t textio_stream_p = {
     .read = file_obj_read,
     .write = file_obj_write,
+    .ioctl = file_obj_ioctl,
     .is_text = true,
 };
 
diff --git a/tests/io/file_seek.py b/tests/io/file_seek.py
index 2ced3576d3ec23a2dcd71070e6e293e222236d98..922b16928054d053f8a67eb808a17d7f6725cb2b 100644
--- a/tests/io/file_seek.py
+++ b/tests/io/file_seek.py
@@ -10,3 +10,11 @@ print(f.read(20))
 
 print(f.seek(0, 0))
 print(f.read(5))
+
+f.close()
+
+# test text mode
+f = open("io/data/file1", "rt")
+print(f.seek(6))
+print(f.read(5))
+f.close()
diff --git a/unix/file.c b/unix/file.c
index b2746e078a19284adfc08d5b8d7752af5f04e234..4a11d24bde29ee1d1b8858cd0eea5b09c2eb2398 100644
--- a/unix/file.c
+++ b/unix/file.c
@@ -240,6 +240,7 @@ const mp_obj_type_t mp_type_fileio = {
 STATIC const mp_stream_p_t textio_stream_p = {
     .read = fdfile_read,
     .write = fdfile_write,
+    .ioctl = fdfile_ioctl,
     .is_text = true,
 };