Recommendations for USB Barcode Scanner and Thermal Receipt Printer

2020-07-25 Thread Rubén Llorente
Hello,

I am considering to set a Point of Sale (POS) solution for a small
business. Given the chance I'd like to use OpenBSD for it. It is
supposed to be very basic and the software would be a web application
running in a remote server. No pole screen or cash drawer support is
required.

This leaves me with the need of gathering some hardware. This would
be a barcode scanner - afaik they show up as keyboards for the operating
system - and a receipt printer.

Anybody in the list has good (or bad) experiences with USB Barcode
Scanners? Which models with?

What about receipt printers? Does anybody have a recommendation for
those?

Happy OpenBSDing!

-- 
OpenPGP Key Fingerprint:
BB5A C2A2 2CAD ACB7 D50D  C081 1DB9 6FC4 5AB7 92FA



Python 3.8 os.listdir EINVAL on large directories

2020-07-25 Thread Aaron Miller
Hi all,

I am getting a stacktrace from the borg command in the borgbackup
package while checking a backup (see bottom of email for full
output, since it's verbose). The relevant part is this:

filenames = os.listdir(os.path.join(data_path, dir))
  OSError: [Errno 22] Invalid argument:
'/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12'

This is same error is reproducible with a test Python 3.8 program:

 #!/usr/bin/env python

 import os
 os.listdir('/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12/')

Running ktrace & kdump reveals the error is from calling
getdents(2):

 76903 python3.8
CALL  open(0x1ec7f06de3b0,0x3)
 76903 python3.8
NAMI  "/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12/"
 76903 python3.8 RET   open 3
 [...]
 76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
 76903 python3.8 RET   getdents 16384/0x4000
 [...]
 76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
 76903 python3.8 RET   getdents 16384/0x4000
 [...]
 76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
 76903 python3.8 RET   getdents 16384/0x4000
 [...]
 76903 python3.8 CALL  getdents(3,0x1ec7c9257000,0x4000)
 76903 python3.8 RET   getdents -1 errno 22 Invalid argument

Looking at the man page for getdents(2), I found it interesting
that it says this call "is not a portable interface and should not
be used directly by applications" and it recommends using
readdir(3) instead.

To give you a rough idea of the number of files and filename sizes
in this directory:

  $ ls /mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12/ | wc
  15341534   10738

Where does the problem lie -- the upstream Python code, the
OpenBSD-specific patches in its port definition, or somewhere
else? And in case it matters, this is a -current amd64 system,
with "sysupgrade -s" executed on 7/15.

Thank you,
Aaron Miller

--
Exception ignored in: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-
packages/borg/repository.py", line 180, in __del__
assert False, "cleanup happened in Repository.__del__"
AssertionError: cleanup happened in Repository.__del__
Local Exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/borg/archiver.py",
line 4565, in main
exit_code = archiver.run(args)
  File "/usr/local/lib/python3.8/site-packages/borg/archiver.py",
line 4497, in run
return set_ec(func(args))
  File "/usr/local/lib/python3.8/site-packages/borg/archiver.py",
line 161, in wrapper
with repository:
  File "/usr/local/lib/python3.8/site-
packages/borg/repository.py", line 190, in __enter__
self.open(self.path, bool(self.exclusive),
lock_wait=self.lock_wait, lock=self.do_lock)
  File "/usr/local/lib/python3.8/site-
packages/borg/repository.py", line 450, in open
segment = self.io.get_latest_segment()
  File "/usr/local/lib/python3.8/site-
packages/borg/repository.py", line 1253, in get_latest_segment
for segment, filename in self.segment_iterator(reverse=True):
  File "/usr/local/lib/python3.8/site-
packages/borg/repository.py", line 1241, in segment_iterator
filenames = os.listdir(os.path.join(data_path, dir))
OSError: [Errno 22] Invalid argument:
'/mnt/thinkpad_void_obsd_borg/thinkpad.borg/data/12'

Platform: OpenBSD millipede.iforgotmy.name 6.7 GENERIC.MP#348
amd64
Borg: 1.1.13  Python: CPython 3.8.3 msgpack: 0.5.6
PID: 31745  CWD: /mnt/thinkpad_void_obsd_borg
sys.argv: ['/usr/local/bin/borg', 'check', 'thinkpad.borg']
SSH_ORIGINAL_COMMAND: None



Re: Recommendations for USB Barcode Scanner and Thermal Receipt Printer

2020-07-25 Thread Erling Westenvik
On Sat, Jul 25, 2020 at 08:47:48PM +0200, Rubén Llorente wrote:
> Anybody in the list has good (or bad) experiences with USB Barcode
> Scanners? Which models with?

I have a working barcode scanner, Symbol Technologies LS2208, that
shows up in dmesg as:

uhidev4 at uhub3 port 6 configuration 1 interface 0 "?Symbol
Technologies, Inc, 2002 Symbol Bar Code Scanner" rev 2.00/2.01 addr 4
uhidev4: iclass 3/1
ukbd1 at uhidev4: 8 variable keys, 6 key codes, country code 33
wskbd2 at ukbd1 mux 1
wskbd2: connecting to wsdisplay0

It's an old model, manufactured in 2005, and I can't say that I've used
it extensively, but it seems to work well with at least "normal"
barcodes typically found on groceries, books (ISBN), receipts and so on.
There are barcodes that it cannot read but I have not investigated the
matter. The manufacturer still exists.

Good luck!

Erling



Re: video capture / streaming

2020-07-25 Thread Jordan Geoghegan




On 2020-07-24 08:06, Rudolf Sykora wrote:

Dear list,


I'd like to stream video from my (usb-connected) camera via a web
server. The 1st I tried was to see if the camera works. So:

odin$ video
video: /dev/video: Permission denied
odin$ doas video
No protocol specified
video: cannot open display :0.0
odin$ xhost +
access control disabled, clients can connect from any host
odin$ doas video
^Codin$

Ie, at last I saw an X window with the video. But is it possible to run
the video command as an ordinary user? (I had to doas...)

Next I want to stream the video via some kind of a server.
On the internet I saw people using 'ffmpeg' to serve the file somehow,
as well as using 'nginx' with the 'rtmp' module. Is any of this the way
how you would achieve the goal, or is it possible to use, say, the 'httpd'
server?

At this moment I know very little both about streaming and available
servers to do the job, and that's why I am asking for recommendation
based on some experience and knowledge.

Thank you for any comments.


Ruda


Hi Ruda,

You can configure FFmpeg to dump an HLS stream into a location served by 
httpd. FFmpeg does support some USB cameras using the V4L2 protocol, but 
you may need to play around with formats and resolutions to get the 
optimal experience/performance. I've done this extensively, as I'm 
currently working on a CCTV project that will run natively on OpenBSD.


Regards,

Jordan



Re: Fixed IP address for vmd dedicated VMs from dhcpd every boot/reboot

2020-07-25 Thread Martin
Thanks guys, this helps!

Martin

‐‐‐ Original Message ‐‐‐
On Saturday, July 25, 2020 8:41 AM, Kapetanakis Giannis 
 wrote:

> On 25/07/2020 11:28, Martin wrote:
>
> > Hi,
> > Sometimes dedicated VMs need fixed (the same) IP address assigned by dhcpd 
> > every run. I don't know how to achieve this by dhcpd configured. Every VM 
> > reboot it gets different IP. OpenBSD guests changes their IPs even without 
> > reboot, right in runtime.
> > For instance I need to assign these IP addresses to VMs every run to 
> > dedicated VMs by dhcpd:
> > OpenBSD obsd0.qcow2 10.0.1.12
> > OpenBSD obsd1.qcow2 10.0.1.13
> > OpenBSD obsd2.qcow2 10.0.1.14
> > Linux lin0.qcow2 10.0.1.22
> > Linux lin1.qcow2 10.0.1.23
> > It looks like MAC of guests changed every boot, so dhcpd assigned different 
> > IP address from the pool every boot/reboot.
> > Please advice any way how to fix it.
> > Thank you for answer in advance.
> > Martin
>
> Not familiar at all with VMM but vm.conf(5) says:
>
> [locked] lladdr [etheraddr]
> Change the link layer address (MAC address) of the
> interface on the VM guest side. If not specified, a
> randomized address will be assigned by vmd(8). If the
> locked keyword is specified, vmd(8) will drop packets
> from the VM with altered source addresses.
>
> dhcpd.conf(5) also has examples on how to assign same IP per host MAC
>
> G




Re: monitoring-plugins-2.2p8: check_dhcp broadcast requests not working

2020-07-25 Thread Stuart Henderson
On 2020-07-22, Marcos Madeira | Secure Networks  
wrote:
> Hello ports@,
>
> I am unable to get broadcast DHCP requests to be generated on openbsd
> 6.6 and 6.7 using the packaged versions of monitoring-plugins, which are
> monitoring-plugins-2.2p8 and monitoring-plugins-2.2p9, respectively.
>
> I have tested the package on a few different environments and it boils
> down to this:
>
> - unicast DHCP is working fine with something like: -i vio1 -v -t 3 -m
> "52:54:00:f3:e9:cb" -r 10.10.0.10 -s 10.10.0.2 -u
>
> - if the server runs something like
> '/usr/local/libexec/nagios/check_dhcp -i vio1', which should be a
> broadcast request:
>
>   - packets will always exit through the first phsical ethernet
> interface (e.g. vio0)
>
>   - no reply received
>
> - if the server runs something like
> '/usr/local/libexec/nagios/check_dhcp -i vio0'
>
>   - if the interface has no address, a packet will not be sent at all.
> No local unicast addess needed with IPv4 broadcast DHCP client
>
>   - if the interface has an address, no DHCP replies are ever received
>
> Unicast-based DHCP monitoring works fine, but this type of monitoring
> does not meet the criteria for rogue DHCP server detection.
>
> Can anyone confirm/deny this before I get an opportunity to look at the
> code?

I don't know about the check_dhcp issue, but I have one comment, make
sure you don't have dhcpd/dhclient running at the same time on the same
interface, they hijack dhcp packets using bpf's "fildrop" mechanism and
don't send them to other applications.




Fixed IP address for vmd dedicated VMs from dhcpd every boot/reboot

2020-07-25 Thread Martin
Hi,

Sometimes dedicated VMs need fixed (the same) IP address assigned by dhcpd 
every run. I don't know how to achieve this by dhcpd configured. Every VM 
reboot it gets different IP. OpenBSD guests changes their IPs even without 
reboot, right in runtime.

For instance I need to assign these IP addresses to VMs every run to dedicated 
VMs by dhcpd:

OpenBSD obsd0.qcow2 10.0.1.12
OpenBSD obsd1.qcow2 10.0.1.13
OpenBSD obsd2.qcow2 10.0.1.14

Linux lin0.qcow2 10.0.1.22
Linux lin1.qcow2 10.0.1.23

It looks like MAC of guests changed every boot, so dhcpd assigned different IP 
address from the pool every boot/reboot.

Please advice any way how to fix it.

Thank you for answer in advance.

Martin



Re: CPU usage of httpd+slowcgi

2020-07-25 Thread Stuart Henderson
On 2020-07-24, Kihaguru Gathura  wrote:
> Hi,
>
> Which of the following legacy CPU types is best suited for very busy web
> server httpd+slowcgi
>
> Niagara CPU Such as T2 - More parallel Threads and Low power per single
> thread
> Sparc64 CPU such as VI, VII - Fewer threads but more computing power per
> thread.
>
> How is multithreading utilization of httpd+slowcgi like?

Like most of the base system, httpd and slowcgi are not multithreaded,
also OpenBSD's scheduler doesn't really know about multithread cpus
(and even for full cpu cores, beyond a handful of cores OpenBSD doesn't
cope all that well).

Generally fewer faster cores is the way to go for OpenBSD.




Re: Fixed IP address for vmd dedicated VMs from dhcpd every boot/reboot

2020-07-25 Thread Kapetanakis Giannis

On 25/07/2020 11:28, Martin wrote:

Hi,

Sometimes dedicated VMs need fixed (the same) IP address assigned by dhcpd 
every run. I don't know how to achieve this by dhcpd configured. Every VM 
reboot it gets different IP. OpenBSD guests changes their IPs even without 
reboot, right in runtime.

For instance I need to assign these IP addresses to VMs every run to dedicated 
VMs by dhcpd:

OpenBSD obsd0.qcow2 10.0.1.12
OpenBSD obsd1.qcow2 10.0.1.13
OpenBSD obsd2.qcow2 10.0.1.14

Linux lin0.qcow2 10.0.1.22
Linux lin1.qcow2 10.0.1.23

It looks like MAC of guests changed every boot, so dhcpd assigned different IP 
address from the pool every boot/reboot.

Please advice any way how to fix it.

Thank you for answer in advance.

Martin



Not familiar at all with VMM but vm.conf(5) says:

[locked] lladdr [etheraddr]
 Change the link layer address (MAC address) of the
 interface on the VM guest side.  If not specified, a
 randomized address will be assigned by vmd(8).  If the
 locked keyword is specified, vmd(8) will drop packets
 from the VM with altered source addresses.

dhcpd.conf(5) also has examples on how to assign same IP per host MAC

G