Repository navigation
Closed
Description
I am getting the following error with the recently released stretch package:
>>> import ev3dev.ev3 as ev3
>>> s = ev3.Screen()
>>> s.clear()
>>> s.update()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 3320, in update
self.mmap[:] = self._img.tobytes("raw", "1;IR")
IndexError: mmap slice assignment is wrong size
It seems the same error prevents openrobertalab service from working:
$ journalctl -n 100
Oct 28 10:08:34 ev3dev openrobertalab[1992]: INFO:roberta:--- starting ---
Oct 28 10:08:34 ev3dev openrobertalab[1992]: INFO:roberta.lab:python path: /usr/bin:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabi:/usr/lib/python3.5/lib-
Oct 28 10:08:34 ev3dev openrobertalab[1992]: INFO:roberta.lab:status changed: disconnected
Oct 28 10:08:38 ev3dev openrobertalab[1992]: Traceback (most recent call last):
Oct 28 10:08:38 ev3dev openrobertalab[1992]: File "/usr/bin/openrobertalab", line 41, in <module>
Oct 28 10:08:38 ev3dev openrobertalab[1992]: main()
Oct 28 10:08:38 ev3dev openrobertalab[1992]: File "/usr/bin/openrobertalab", line 36, in main
Oct 28 10:08:38 ev3dev openrobertalab[1992]: service = Service('/org/openroberta/Lab1')
Oct 28 10:08:38 ev3dev openrobertalab[1992]: File "/usr/lib/python3/dist-packages/roberta/lab.py", line 88, in __init__
Oct 28 10:08:38 ev3dev openrobertalab[1992]: self.hal.clearDisplay()
Oct 28 10:08:38 ev3dev openrobertalab[1992]: File "/usr/lib/python3/dist-packages/roberta/ev3.py", line 179, in clearDisplay
Oct 28 10:08:38 ev3dev openrobertalab[1992]: self.lcd.update()
Oct 28 10:08:38 ev3dev openrobertalab[1992]: File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 3320, in update
Oct 28 10:08:38 ev3dev openrobertalab[1992]: self.mmap[:] = self._img.tobytes("raw", "1;IR")
Oct 28 10:08:38 ev3dev openrobertalab[1992]: IndexError: mmap slice assignment is wrong size
Oct 28 10:08:38 ev3dev openrobertalab[1992]: INFO:roberta:--- done ---
This is on the latest snapshot (snapshot-ev3dev-stretch-ev3-generic-2017-10-24.img.xz). The stretch-compatible ev3dev version is there, since leds are working:
>>> import ev3dev.ev3 as ev3
>>> ev3.Leds.all_off()
Metadata
Metadata
Assignees
Labels
No labels
Activity
ddemidov commentedon Oct 28, 2017
@dlech, were there any changes in framebuffer on stretch? For reference, here is what we currently do:
ev3dev-lang-python/ev3dev/core.py
Lines 3093 to 3234 in 02fa602
dlech commentedon Oct 28, 2017
There is now 2bpp support in the driver, so
fix_info.smem_lenis probably twice as big as it was previously.Could you change
to
?
ddemidov commentedon Oct 28, 2017
That works, although I had to invert the image (or rather stop inverting it, by using "1;R" instead of "1;IR").
The following patch works for me:
I am bit surprised by the result though.
tobytes("raw", "1;R")should give us raw 1-bit-per-pixel image. Why assigning the result to a 2-bit-per-pixel framebuffer works?dlech commentedon Oct 28, 2017
The fbdev device has two modes of operation, 1bpp and 2bpp. Be default, it still operates in 1bpp mode. The memory allocated has to be big enough for both modes, so the 1bpp mode only uses 1/2 of the allocated memory.
ddemidov commentedon Oct 28, 2017
Ok, that makes sense. I'll create PRs for
stretch-stableanddevelopthen.dlech commentedon Oct 28, 2017
I'm wondering about the inversion though. I don't recall switching from
FB_VISUAL_MONO10toFB_VISUAL_MONO01but maybe I did.ddemidov commentedon Oct 28, 2017
Do you need more info from me on this? The EV3 is next to me right now.
dlech commentedon Oct 28, 2017
The driver still says
FB_VISUAL_MONO10, so I would expect that the inversion is still needed.https://github.com/ev3dev/lego-linux-drivers/blob/ev3dev-stretch/linux/fbdev/st7586fb.c#L483
ddemidov commentedon Oct 28, 2017
Well, without the inversion
s.clear()gives me black screen, ands.draw.rectangle((10,10,168,118))gives me a white-on-black rectangle.Fix Display class on stretch.
dlech commentedon Oct 28, 2017
ev3dev-lang-python/ev3dev/display.py
Line 257 in 8e57eea
says clear should fill with white, not black
ddemidov commentedon Oct 28, 2017
I believe that is because we had to do inversion.
Fix Screen class on stretch.
Fix Screen class on stretch. (#425)
Fix Display class on stretch. (#424)
ddemidov commentedon Oct 29, 2017
Fixed by #424 (
develop, aka v2) and #425 (stretch-stable, aka v1). Also pushed the updated packages for the stretch-stable version.Fix Screen class on stretch. (ev3dev#425)