Add support for Star Line Mode protocol, used by most Star receipt
printers.
closesodoo/odoo#60371
Taskid: 2365648
X-original-commit: cd0545b98fc1e7a66dd46eb6a283736ef58ac4ff
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
We used to patch http.py using a diff. This was really not practical
because every time the file was modified, the diff had to be recreated.
We now override the specific methods directly.
closesodoo/odoo#60366
X-original-commit: a6012f03ff02f04a3d128e33326f932fd22f0ced
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
We sometimes encountered IoT Boxes crashing because the remount failed.
As this isn't a big issue, we won't check the return value of the call
to `mount`.
closesodoo/odoo#59438
X-original-commit: 5f9874da0f5f5b27c546cd248d08299f0e65544b
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
The path to folder of images of IoT has change.
So we adapt the path for the upgrade of IoT
closesodoo/odoo#57978
X-original-commit: 9512a23f48176fe0e7970039c824281c4af18162
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
If IoT Box is on access point mode the box try to reach https://iot-proxy.odoo.com
to get pairing code. So the box try while 5 minutes to reach iot-proxy
and send request on network every 10 secondes.
Now we add a condition 'if not access_point()' to send these request.
closesodoo/odoo#57976
X-original-commit: 901dc987c0204a7df2b811bb430f31eabf204fbb
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
We make request to iot-proxy.odoo.com every 10 secondes
while 5 minutes.
But we have a traceback if we don't have a internet connection.
So we put a 'try except' to catch error
Related 841c016913a8
closesodoo/odoo#57567
X-original-commit: 3227490e270a1f5b98ef7811edca59e9aa1b6b55
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
When printing a long receipt from the POS, the printer crashed, printed
random characters and needed to be rebooted to print other receipts.
The problem was that there's a limitation of height when printing
images with ESC/POS (see [ESC/POS documentation](http://www.starmicronics.com/support/mannualfolder/escpos_cm_en.pdf), page 158).
We then split the image into slices and print slices with separate
commands.
closesodoo/odoo#57512
X-original-commit: ab06df30557af90f3e704d4cfc1e6da66f7708b7
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
The threads of devices were still running after `disconnect` had been
called. We add a `_stopped` flag that is set when the thread should be
stopped.
closesodoo/odoo#56500
X-original-commit: 639a4e4fc72567a9655599eef150fabefaf1ff2e
Related: odoo/enterprise#12651
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
- Split driver.py to multiple files
- Remove hw_proxy module as most of its routes were not used and
move remaingin routes to a controller in hw_drivers
- Add missing coding and license lines at the beginning of files
- Reorder imports and remove unused ones
- Rename device_id to device_identifier for clarity
- Rename screen to display for consistency
- Other minors improvements
Taskid: 1973956
X-original-commit: 841c016913a87133bf7257c62ae5f6bf7d99e06d
`device_name` and `scanner_name` were defined outside of the scope of
the function where they were used in.
We move them and try to simplify the logic a bit.
closesodoo/odoo#56454
X-original-commit: e59e311578aa0b4539ef27580462a2c2e1dce970
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
Some scanner are detected like keyboard because they do not meet
the conditions to be supported as a scanner by the driver.
So we add the possibility to manually switch the type of device
between scanner and keyboard.
closesodoo/odoo#56053
Related: odoo/enterprise#12370
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Some network Zebra printer are not detected because
the protocol 'socket' is not supported.
Now we add this protocol in the 'supported' function
closesodoo/odoo#56146
X-original-commit: f7fa40bdbbd765caf8fe528fff949b4dccf3d8c2
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
We move the IoT Box version file from /home/pi to /var/odoo
so its not overriden after an auto-flash of the IoT Box.
closesodoo/odoo#54063
X-original-commit: ce0700ce401523267b5a8bd5665a368cfea24912
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Trying to call display_refresh or update_url when no screen was
connected to the IoT Box and the default distant_display was created
resulted in an error.
closesodoo/odoo#53975
X-original-commit: 77768b93bc64d47abdbd4abd48c386acb293815e
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
In Chrome 84, mixed content will be completely blocked for security
reasons ([see blog](https://blog.chromium.org/2019/10/no-more-mixed-messages-about-https.html))
Other browsers will probably follow in the next months.
As IoT Boxes don't have a valid certificate before connecting to a DB,
we used mixed passive content to communicate with the boxes.
This won't be possible anymore, and we have no possible way to
communicate directly from the browser to the box.
- When an IoT Box boots without registered DB, a unique code will be
created with a validity of 5 minutes.
- This code will be shown on the customer display and printed on the
status ticket.
- The box will call a route on odoo.com and a record will be created
in odoo.com with the unique code.
- The user will have to enter the code manually in his DB to connect
to the IoT Box, the DB will then contact odoo.com to search for a
record containing the unique code. If it's found, the
`openerp.enterprise.database` will be added to the record.
- The box will then query odoo.com at regular intervals (10 seconds)
to check if a DB is linked to the code.
closesodoo/odoo#53623
Taskid: 2246535
X-original-commit: c55f12e32598a713105f3c049ac053e46ba15bb2
Related: odoo/enterprise#11421
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))
Old syntax is still compatible but starts the migration to the new
syntax that catches error.
When we print a ticket status with a thermal printer we need printer's device-id
But if we add manually a printer this device-id doesn't exist
So now we update de devices list with a supported = True if
printer are manually added
closesodoo/odoo#53072
X-original-commit: 89bbc555ecf520ee34a9b1292a2bdb5c937b18e2
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
The IoT Box detects printers automatically under certain conditions.
And so there are printers that are not detected by the box
and cannot be used in Odoo.
With this commit we give the possibility to add printers manually
with Cups and to be able to use them in Odoo.
closesodoo/odoo#52154
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
When the route '/hw_drivers/box/connect' is called to connect an IoT Box to a DB,
the checkout on the branch of the DB is not performed and incompatibility can occur.
With this fix we relaunch Odoo via a parallel thread in order to be able to respond to the request...
closesodoo/odoo#52513
X-original-commit: 9aca7c464cef492c495a0c72d870b7075187dc63
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
- The checkout to switch to the branch of the connected DB was not
processed correctly because the command used to clear the drivers
failed, raising an exception:
rm: cannot remove '/home/pi/odoo/addons/hw_drivers/drivers/__pycache__': Is a directory
- The location of the drivers has been changed in master. So, even if we
perform a checkout, the addons/hw_drivers/drivers directory doesn't
exist. The get_resource_path('hw_drivers', 'drivers') then returned
False instead of the correct path and the extraction of the zip file
failed.
closesodoo/odoo#52448
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
The `get_string` method from the `pyusb` package has changed its
signature after version 1.0.0b1 so we used to force the IoT Box to use
this version to avoid an error. The problem is that version 1.0.0b1
has dependencies that raise DeprecationWarings in Raspbian Buster.
We then want to update the version of pyusb that is installed on the
IoT Box in 14.0.
As the Driver might be loaded to old versions of the IoT Box as well
as new ones, we need to check what version of the package is present
on the IoT Box before calling `get_string`.
This check will be removed in 14.0, as people will have to use the
latest version of the IoT Box.
closesodoo/odoo#52374
X-original-commit: e5475ae8ceca2121d15985ac7446f90dbd59b485
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
Previously, we tested the `supported` methods of all drivers
sequentially in alphabetical order of file names. If you wanted to
extend a driver, the `supported` method of your driver could never be
tested if the one of its parent was tested first.
We've now added a priority order to drivers so that by default the
extending driver will always be tested before the extended driver.
You can still do something similar to what `is_tested_last` did by
manually setting the priority of a driver to 0.
Ex: The way barcode scanners is really similar to keyboards, but still
requires a few modifications in the driver. We couldn't extend the
keyboard driver easily because the supported method of barcode scanners
had to be more strict than the one of keyboards. If the
KeyboardUSBDriver was tested first, scanners were recognized as
keyboard and didn't have all the specific features of scanners.
TaskID: 2082282
Until now, to detect new types of devices on the IoT Box, we had to
modify driver.py. If partners wanted to connect a new type of device,
they had to modify directly the files on the Box, meaning that after
each new build they had to re-apply all their modifications.
We remove the loops that detected the connected devices and replace
them by `Interfaces`. All interfaces will be loaded from the connected
Odoo instance with the corresponding drivers.
TaskID: 2082282
Exceptions were not logged correctly due to a typo in ExceptionLogger.
closesodoo/odoo#51191
X-original-commit: 9ac2ad249bddc631de9a9d587058d6109918f584
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
Steps to reproduce:
- Start the IoT Box with a monitor plugged in
- Unplug the monitor
- Restart the Odoo service (i.e. connect the IoT Box to a DB)
- No devices are detected
The problem came from the fact that `tvservice -l` and `tvservice -n`
have different behaviors when a monitor is disconnected:
- `tvservice -l` still says that a device is attached
- `tvservice -n` cannot detect the name of the device so it logs an
error to stderr but still has a return value of 0 so we read an empty
string from stdout.
The `get_connected_displays` function raised an exception because the
format of the returned string was not the one we excepted. The other
loops were then not started and no devices at all were detected.
closesodoo/odoo#50839
X-original-commit: ab6ec2ab6d30a86f9741da4b1986831772004d91
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
When we change the version of branch we keep drivers.
But drivers are not compatible with all branch and Odoo
on the IoT Box can't start.
So we remove all drivers before checkout on another branch
closesodoo/odoo#50140
X-original-commit: 4e97aec6717697c742e5e0b09f00ab7dec09712f
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Before this commit, a lot of leftover import shims existed in the
codebase for py2-py3 compatibility, these are no longer needed since
Odoo 13.0+ doesn't support Python 2 anymore and is (finally) in EOL.
With this commit, these shims are dropped, making the code cleaner,
easier to read and with one less dependency.
Queue -> queue -> py2-py3 compatibility
xmlrpclib -> xmlrpc.client -> py2-py3 compatibility
ConfigParser -> configparser -> py2-py3 compatibility
itertools.izip_longest -> itertools.zip_longest -> py2-py3 compatibility
urllib -> urllib.request -> py2-py3 compatibility
__builtins__ -> builtins -> py2-py3 compatibility
_winreg -> winreg -> py2-py3 compatibility
mock -> unittest.mock -> merged into CPython
The debian/fedora packages and requirements.txt have been updated accordingly
closesodoo/odoo#44601
Related: odoo/enterprise#8141
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This reverts commit 9d43308a8f6b521d3d18f7fc472303f58f56a0c3.
No one should be using MPD in production at the moment but
we'll still leave it in the buiold of the Box, just to be sure.
X-original-commit: 129101815d5846d5b53148546b19bdd791f22aac
We use a library to get mac address of IoT in homepage.
however we already have a function that does this in the helper in hw_drivers
closesodoo/odoo#46631
X-original-commit: ae78e9cdde777ffac6f08a35dd00a540c92130bb
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
We had two issues when reading the weight from a scale connected to
the IoT Box :
When using the '/hw_proxy/scale_read' route, if the same weight was
read twice, the value in PoS was reset to 0.
If the product was placed on the scale before opening the weight
screen, the weight was never read.
closesodoo/odoo#46432
X-original-commit: a08c5157f0b042e2ee250fc7b431b90451c7781a
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
Remove the MPD server and Six configuration from the IoT Box.
MPD will be replaced by TIM, which doesn't require the IoT Box.
closesodoo/odoo#46424
Taskid: 2188566
X-original-commit: 9d43308a8f6b521d3d18f7fc472303f58f56a0c3
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
For update correctly the route list of IoT after loading driver
we need set 'http.addons_manifest' to a empty json
Linked to 97c09e1c77284836c7c46b4e70d4f12eb48ce91b
Reboot not needed after a update
Linked to b77486753b7ae220a531ee09c529fb5eb944b0e2
Linked to 181a62cb57e143611ca1fbf0779cfd041d2a3cf8
closesodoo/odoo#46386
X-original-commit: 87b127efed97c1f6fad18d6ee6b5924a9b2c70f2
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
We replace the SSID of the IoTBox with a unique SSID
closesodoo/odoo#46255
X-original-commit: c847c1cb149e386331ff2e5b19a58862e1b66714
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
If IoT Box is in access point mode and a server is configured
the box try to reach the server.
But in access point mode all requests are redirected to the box
So now before return True in function 'get_odoo_server_url'
we verify if the service 'hostapd' is inactive
closesodoo/odoo#46141
X-original-commit: 365f0e384630bad16e0872d2307702fca5a4e295
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
To be able to flash the partition on which the IoT Box is executed,
we must create a third partition and install an OS there to be able
to boot on it and flash the partition of the IoT Box
- Creation of the third partition
- Raspbian download and checksum verification
- Installation of Raspbian on the third partition
- Download the IoT image on the Raspbian partition and check the checksum
- Reboot on the Raspbian partition
- Installation of the IoT image on the second partition
- Reboot on the IoT partition
- Cleaning and deleting the third partition
closesodoo/odoo#44430
Task: 2161955
X-original-commit: 407d9a88a3d23ed49ed5a2c5fa4d211cec43edfd
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Pedals plugged in the IoT Box were not sending any data to the
connected Odoo DB.
The name of the device couldn't be retrieved, and the pedals were given
the default name "Unknown keyboard or scanner".
Since this default name included "scanner", the device was recognized
as a barcode scanner and no data was sent until Enter was pressed,
which never happened.
closesodoo/odoo#43914
X-original-commit: dba811f67439807a67749e6a41dbf92f4060a326
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
Key input is handled in an evdev event loop. Before this commit the
state of modifier keys like shift, caps lock, ... were read when the
event was being processed. This doesn't always work because the evdev
events are processed asynchronously, i.e. when key A is being processed
in Python key B may have already been pressed.
Some devices that type fast, notably the Magtek card reader, this leads
to modifiers being applied to the wrong characters. Here's an example
before the patch:
5895000020000006^TEST/VAnTIV^251200000000000000?;4895000020000006=251200
000000000/\0600\0dD15ac71B75BA468E51F4e657529ADF6E3BDAC0A86A59B7adA12029
22F64BB55E74880A1908AD08AFC9372ADe21FD1E74D409C912C1A5|5C3D07B727DE46DaF
B6D8ED2007DB219F49FAC1311F0fa01474FC5BC621F33F915BE77D8DAF5E69A||6140300
0|076C0B3B0704CD78D7CF7Dc5B2ED3F0Ca3ad2e6c88d1F2310B7DB96973b4D556c2f9e4
016C60a7DB581990567FE5656E02C27276FA43BFE|B2ECCDE070215AA|336a4f78bb3c4C
\901209b2eCde000f3\4fC\100
This is what it looks like after the patch:
%B4895000020000006^TEST/VANTIV^251200000000000000?;4895000020000006=2512
00000000000?|0600|FE511F7BA7C38A4FA85D0135E58DDC798E557819356DADA132ECBE
D95184CCC77D7E2B1AE7E8AB076488B9757CA2A046C70590D01FA86217|5DAFE6EC44372
A3EF0358D42D08D9246DD8D2837150954B758199207697EFEB08A71B38B2E1690CE||614
03000|584CB8EBE3B17D2828C3B010DFB4E63E9F5036705CF7E547707DC75A9408E958DC
A3052B03031EA0F3B1F1163E40EF3F542B70F9FFD7912D|B2ECCDE070215AA|21352532D
D6E7334|90CDE0001FA|06A6||1000
These are some of the issues visible in the above example:
- there's a 5 instead of a % (on QWERTY SHIFT-5 is %)
- the n in VAnTIV is lowercase
- there's many /'s which should be ? (on QWERTY SHIFT-/ is ?)
- there's many \'s which should be | (once again on QWERTY SHIFT-\ is |)
To solve the issue, we read the state of the modifiers in the same event
loop.
opw-2122553
closesodoo/odoo#42767
X-original-commit: caa4c7ef6d23f695827b58e60a013a9438eb67cf
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
It behaves exactly the same as a barcode reader, and pos_mercury uses
the barcode nomenclature to make it work. For reference, the full name
is:
Mag-Tek - USB Swipe Reader
opw-2122553
X-original-commit: 635f1ea8527f4489b8c56b5d18856c7d2c60737e
Preivously, the code of the IoT Box was retrieved from the branch that
was used during the build but the drivers were retrieved from the
connected Odoo DB. Both could be in different versions, which forced
used to make old drivers compatible with the new Box or new drivers
compatible with old versions of the Box.
All of this made it quite hard to modify the existing code, even for
new versions of the Box in master.
When connecting the IoT Box to an Odoo DB, we now retrieve the version
of Odoo that is used and checkout the Box to this branch. This means
that we can now modify the code of the Box in master without having to
worry about users using the latest build with older DBs.
Taskid: 2120749
X-original-commit: 6af5d669593a4f431d14fce08c6151932f97da82
We add a condition to add printer.
Printer, for protocol DNSSD and LPD, must have a "model"
closesodoo/odoo#41591
X-original-commit: a07f118fc7182fa96344fad4a0164ed86c446352
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Actual IoT Box not detect correctly Epson TM-T88v.
Now we can detect printer even if name is 'Unknow'
closesodoo/odoo#41563
Taskid: 2153108
X-original-commit: 4c7a1d7a9ba2ad0fbdd92b3a73b0d6294cb6e4a3
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Change the version of the IoT Box.
From 19_10 to 19_12
closesodoo/odoo#41109
X-original-commit: 2b8779dc657a5a2b877ad2a552dd0dfda0071357
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
We clean the code for the MPDManager by removing useless lines and
simplifying the way we run the MPD server.
closesodoo/odoo#40892
Related: odoo/enterprise#6892
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Exceptions were logged to stderr so we couldn't see them when Odoo was
running as a service on the IoT Box. We now redirect stderr to the logger
to see track errors in the log file too.
closesodoo/odoo#41028
Taskid: 2146835
X-original-commit: 54a1919cbc37f5832ce110605c29b222c7a5bfe9
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
Customer displays were all using the same URL and therefore could only
show the same products. We now use different URLs per screen.
Two screens connected to the same IoT Box can now display customer
displays from different POS.
closesodoo/odoo#41026
Taskid: 2123511
X-original-commit: 12569b0e7f7a9e447f8df908597131911c5cfef8
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>
We now support the RPI4 which has 2 micro-HDMI outputs, while the
prvious driver only supported one display. We add support for a second
display.
Taskid: 2123511
X-original-commit: 5886c3a864c990fcd7b852baafab752e7da90494
The status ticket contains ESC/POS commands but was printed on all
printers connected in USB. Plugging a printer that doesn't support
ESC/POS resulted in undefined behaviors.
We now only print this status ticket on ESC/POS printers.
closesodoo/odoo#40972
X-original-commit: c6a28b627cbe6f8bd1da4321c1329cbc1bde498d
Signed-off-by: Antoine Prieëls <aprieels@users.noreply.github.com>