Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "tests/fake-sys"]
path = tests/fake-sys
url = https://github.com/rhempel/ev3dev-lang-fake-sys.git
url = https://github.com/ddemidov/ev3dev-lang-fake-sys.git
3 changes: 3 additions & 0 deletions ev3dev/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def get_current_platform():
"""
board_info_dir = '/sys/class/board-info/'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should just use the existing "constant" on the Device class along with the path concatenation method, like we do for sensors/motors/etc. That would eliminate the need for special-casing it. With the code you have now, there'd have been no reason to update the submodule in the first place 😆

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I found that what got added in the submodule didn't work (there needs to be a board-info directory with specific structure, but board-info in the submodule is just a text file) and just wanted to get the CI tests passing for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

My bad, will fix this today.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't have the EV3 around to test this myself; do I understand correctly there needs to be a board-info/fake-board/uevent file? And that should contain fake?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yep, this is what it looks like on an ev3

robot@ev3[~]# tree /sys/class/board-info/
/sys/class/board-info/
└── board0 -> ../../devices/platform/board/board-info/board0

1 directory, 0 files
robot@ev3[~]# cat /sys/class/board-info/board0/uevent 
BOARD_INFO_HW_REV=7
BOARD_INFO_MODEL=LEGO MINDSTORMS EV3
BOARD_INFO_ROM_REV=6
BOARD_INFO_SERIAL_NUM=00165346201F
BOARD_INFO_TYPE=main
robot@ev3[~]# 

It needs to contain BOARD_INFO_MODEL=FAKE-SYS

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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


if not os.path.exists(board_info_dir):
return 'fake'

for board in os.listdir(board_info_dir):
uevent_filename = os.path.join(board_info_dir, board, 'uevent')

Expand Down
2 changes: 1 addition & 1 deletion ev3dev/sensor/lego.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
raise SystemError('Must be using Python 3.4 or higher')

import time
from ev3dev._button import ButtonBase
from ev3dev.button import ButtonBase
from ev3dev.sensor import Sensor


Expand Down
2 changes: 1 addition & 1 deletion tests/fake-sys