Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions can/interfaces/slcan.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

"""

import io
from typing import Any, Optional, Tuple
from can import typechecking

import time
import logging

from can import BusABC, Message
from can import typechecking

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -252,9 +253,12 @@ def shutdown(self) -> None:
self.serialPortOrig.close()

def fileno(self) -> int:
if hasattr(self.serialPortOrig, "fileno"):
try:
return self.serialPortOrig.fileno()
# Return an invalid file descriptor on Windows
except (io.UnsupportedOperation):
# Return an invalid file descriptor on a platform which doesn't implement fileno such as Windows
pass

return -1

def get_version(
Expand Down