Open sfbg opened 7 years ago
I don't have a Xperia X. I hope someone else can find the cause for this bug.
I can try to debug it, but where do you think the problem resides?
Please send me the console output. There should be some debugging messages. After that, I can narrow down the cause a little bit.
Here the log: barcode.log I can debug the app if you want, let me know what I can do to help you.
It seems there is a problem with the screenshot creation. Can you send me the following image: /home/nemo/.cache/harbour-barcode/harbour-barcode/capture-code.jpg
there is no image in that folder, is empty.
drwxr-xr-x 3 nemo nemo 4096 Oct 11 21:34 harbour-barcode
I think this code of the class AutoBarcodeScanner is not working:
QDBusMessage m = QDBusMessage::createMethodCall("org.nemomobile.lipstick", "/org/nemomobile/lipstick/screenshot", "org.nemomobile.lipstick", "saveScreenshot"); m << m_decoder->getCaptureLocation(); QDBusConnection::sessionBus().call(m); QImage screenshot(m_decoder->getCaptureLocation());
Can you execute the following command on your Xperia phone?
dbus-send --dest=org.nemomobile.lipstick --session --print-reply /org/nemomobile/lipstick/screenshot org.nemomobile.lipstick.saveScreenshot string:"/home/nemo/Pictures/test.jpg
This command should create a screenshot and save the image in the file test.jpg. It works on my Jolla1. Can you find this file after the execution?
The result on your console should be something like: "method return time=..."
that works fine, I get the screenshot on my Pictures folder.
Output is:
method return time=1508684577.735856 sender=:1.25 -> destination=:1.539 serial=10327 reply_serial=2
EDIT: found the problem!
[nemo@Sailfish ~]$ dbus-send --dest=org.nemomobile.lipstick --session --print-reply /org/nemomobile/lipstick/screenshot org.nemomobile.lipstick.saveScreenshot string:"/home/nemo/.cache/harbour-barcode/harbour-barcode/capture_code.jpg"
Error org.freedesktop.DBus.Error.Failed: File path for screenshot not accepted: path includes hidden part or '..'
EDIT2:
I changed to QStandardPaths::DownloadLocation
and the temporary image is generated, BUT:
btw, why a screenshot dbus message is used instead of taking a real picture with the camera?
I changed the location to QStandardPaths::PicturesLocation
and commited all changes. Can you test it again?
btw, why a screenshot dbus message is used instead of taking a real picture with the camera?
I tested the usage of the class QCameraImageCapture
to take pictures with the camera. After each call of the method capture
the view finder freezes for some seconds. I don't like this behaviour.
As explained above does not work. I wil try to explain what happens: if the capture_code.jpg does not exist, then I can open the barcode app, point the barcode and press "scan". The barcode is detected correctly! But then, I can't take an other barcode anymore until I close the app and remove the capture_code.jpg manually. The cropped area of the image is wrong, like this (capture_code.jpg):
This is what I see on screen:
For the first problem
But then, I can't take an other barcode anymore until I close the app and remove the capture_code.jpg manually.
I need the log file of the entire test.
For the second problem:
The cropped area of the image is wrong, like this (capture_code.jpg):
Please comment out this lines
QImage copy = screenshot.copy(m_viewFinderRect);
copy.save(m_decoder->getCaptureLocation());
and set copy = screenshot
.
I own a Xperia X (flashed to SailfishOS) and want to help to fix this problem. (Because I like your code reader App). My problem: I have no experience with developing / building Sailfish-Apps. So could you please provide an installer file containing your latest fixes for me to test? Or otherwise, what do I need to build and install your application?
Thanks for your offer!
I need the log file with the debugging entries. So it is necessary to start the app with the Sailfish SDK. It's not so complicated to install and run the SDK :-)
BTW: You have to enable the debugging mode on your device => it's a settings option. There you can find the IP address and the remote password.
Feel free to ask if you have any questions.
Thanks for your reply. I hope I will have time to test this tomorrow.
Ok, I have managed to install the Sailfish SDK, cloned your git repo, changed the lines
QImage copy = screenshot.copy(m_viewFinderRect);
copy.save(m_decoder->getCaptureLocation());
to
QImage copy = screenshot;
and deployed your code via the SDK to my Xperia X.
Reproducibility: I can fully reproduce the behavior, @AlmAck described above.
Debug logs: To create debug logs, I did the following:
/home/nemo/Pictures/capture_code.jpg
These are the logs with can be seen in Qt Creator: debug_2017-11-01_20-54.zip (hope this is the data, you wanted to see)
Additional observation:
During this whole process the file /home/nemo/Pictures/capture_code.jpg
is continuously rewritten to the filesystem of the Xperia. But the content is always be identical! Like @AlmAck wrote, for me it looks like this: If the file is not there, a screenshot is taken and written to the filesystem. After ?? milliseconds the process starts over: But this time, the file is found and read from the filesystem, in order to write the identical file back to the filesystem.
At the end of my test, the file /home/nemo/Pictures/capture_code.jpg
did show the same data as seen in the first screenshot "screenshot_20171101_001", so the QR-code detection failed.
Successful Test: Like @AlmAck wrote, I did:
Debug logs: debug_2017-11-01_21-25.zip
Only the issue: The nice markers are no longer drawn on the QR code.
Thanks for your effort and your very good description. It is very helpful. I found the root cause for this issue:
[D] AutoBarcodeScanner::processDecode:237 - reply of method call <screenshot>: QDBusMessage(type=Error, service=":1.12", error name="org.freedesktop.DBus.Error.Failed", error message="File path for screenshot not accepted: File exists", signature="s", contents=("File path for screenshot not accepted: File exists") )
I will fix the problem, so that you can test it again.
Great news. Thanks!
I tested with:
if (scanActive) {
+ if (QFileInfo::exists(m_decoder->getCaptureLocation()))
+ QFile::remove(m_decoder->getCaptureLocation());
and works fine. If you agree, I can create a merge request. Maybe would be better to remove the temporary image at the end?
Sure, you can create a pull request.
On November 2, 2017 8:34:07 PM GMT+01:00, Luca Giambonini notifications@github.com wrote:
I tested with:
if (scanActive) { + if (QFileInfo::exists(m_decoder->getCaptureLocation())) + QFile::remove(m_decoder->getCaptureLocation());
and works fine. If you agree, I can create a merge request.
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/steffen-foerster/sailfish-barcode/issues/34#issuecomment-341533964
You can find the new binaries (version 0.7.12) here: https://openrepos.net/content/steffenf/codereader
It is tested with the lastest version of SailfishOS 2.1.3.7 on Jolla 1.
If you find further problems please send me the log file and all images from the directory Pictures/codereader.
Strange, the app downloaded from openrepos does not work, the one compiled locally does.
I noticed that with your changes the captured image is missing, I see only a black rectangle. Instead I sould see the image with the acquired markers.
Hi, for me the version on openrepos with 0.7.12 also does not work on Jolla 1, SailfishOS 2.1.3.7. Didn't tried yet with own build. Update: own compiled version works, thanks!
One more update: on Jolla Tablet (X86) it does still not work (but i guess that there is another problem based on log and debug screenshots).
See log here: codereader_debug_2017-11-05_182300.zip
The packages on openrepos were outdated. I have uploaded new versions.
I cannot find the problem for the Jolla Tablet in the log file. The images are blank. It seems the screenshot service doesn't work.
Message on your Tablet:
[D] AutoBarcodeScanner::createScreeshot:295 - reply of method call <screenshot>: QDBusMessage(type=MethodReturn, service=":1.25", signature="", contents=() )
Message on my Jolla 1:
[D] AutoBarcodeScanner::createScreeshot:295 - reply of method call <screenshot>: QDBusMessage(type=MethodReturn, service=":1.32", signature="", contents=() )
I only see a difference in the service version.
I tested the new code (commit febccdd1ab9516e0d592c5a8a88b4879b4a4ba45) via QtCreator without local modifications on my Xperia SailfishX 2.1.3.5: Scanning a QR code works on the Xperia! :)
Even the markers (in the corners of the QR code) are back and in correct position. 👍
Thanks!
Some minor issues (which are not necessary for the main functionality):
Scanning for a QR code seems to trigger some "screenshot"-events, which are displayed at the top of the screen on my Xperia X. When you scan for a longer time e.g. 40 seconds, many screenshot-events are triggert. And the smartphone displays each event for a few seconds. So those "top-screen-messages" are still displayed after the QR code scanning has successfully finished. But this is a very minor issue.
After having successfully scanned a QR code and having closed the application by swipe-down-gesture, there do remain 4 JPGs in "/home/nemo/Pictures/codereader": debug_cropped.jpg, debug_screenshot.jpg, debug_transformed.jpg, screenshot.jpg I tried your code on Github, deployed to my smartphone via QtCreator, so this is kind of "developer"-code. But since those pictures also show up in the Jolla gallery, I would suggest to remove those in the final version for harbour.
I looked at the problem with the screenshot events. I can't fix this problem with the current application design. It needs a bigger redesign so I don't need the screenshot service anymore. And this will take some time ...
@palbr I opened #37 for the notification issue.
It does not scan on Xperia X. The camera works, but, after clicking Scan, nothing happens.