Re: arduino usb/com port issue

2020-05-31 Thread Tomasz CEDRO
On Sun, May 31, 2020 at 11:45 PM Gary Aitken wrote:
> >>> I installed the arduino package on an 11.3-RELEASE system.

Message from arduino-1.0.6_3,1:

"--
Notes on using the Arduino IDE:

To allow serial port locking, add your user to the dialer group:
pw groupmod dialer -m myuser
(..)"

Did you add your user to the dialer group? That would allow to you to
access modem/vcom devices which seems exactly what you need. The modem
device is /dev/cuaU* for USB-Virtual-COM-Ports :-)


> >> Did you check the permissions on /dev/usb/XXX ?
>
> These are all set to crw---
> I tried changing all to crw-rw-rw- but still no arduino success

How about /dev/cuaU* ?


> > ***/etc/devfs.rules: [localrules=10] add path 'ugen*' mode 0660 group
> > operator add path 'usb/*'  mode 0660 group operator add path 'usb'
> > mode 0770 group operator
> >
> > ***/etc/rc.conf: devfs_system_ruleset="localrules"
>
> $ cat /etc/rc.conf | grep devfs
> # allow local rules as specified in /etc/devfs.rules (5)
> devfs_system_ruleset="localrules"
>
> $ cat /etc/devfs.rules
> # Allow operator group to mount USB devices
> [localrules=5]
> add path 'da*' mode 0660 group operator
> # for arduino hotplug USB
> add path 'ugen*' mode 0660 group operator
> add path 'usb/*' mode 0660 group operator
> add path 'usb' mode 0770 group operator

Either try adding your user to the dialer group as instructed by the
post-install package message (this is the preferred method, note you
need to logout and login after that), or add `add path 'cuaU*' mode
0660 group operator` as another rule in /etc/devfs.rules so you will
gain access to the /dev/cuaU* files as needed if that method works for
you with other devices :-)

You can restart devfs with `service devfs restart` as root no need to reboot :-)


> I don't understand the need for MINICOM.  I currently use xterm.
> Will that work for the print output?

MINICOM can talk to the /dev/cuaU0 and other serial ports like this so
you can test if communication works with your device if other software
fails :-)


Good luck and have fun! :-)
Tomek

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: arduino usb/com port issue

2020-05-31 Thread Gary Aitken

Hello Tomasz and Petter,

Thank you for your replies.  Still working on this:

I installed the arduino package on an 11.3-RELEASE system.  When 
it comes up, the Tools/Serial Port menu item is greyed out, 
apparently because it doesn't know USB ports serve as com ports, 
or for some reason it can't find them.  Is this something I need

to configure somehow?  Is this something that should be filed as
a bug?

...

Did you check the permissions on /dev/usb/XXX ?


These are all set to crw---
I tried changing all to crw-rw-rw- but still no arduino success


And output from usbconfig


# usbconfig -d ugen6.2 dump_device_desc
ugen6.2:  at usbus6, cfg=0 md=HOST 
spd=FULL (12Mbps) pwr=ON (100mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0110
  bDeviceClass = 0x0002  
  bDeviceSubClass = 0x
  bDeviceProtocol = 0x
  bMaxPacketSize0 = 0x0008
  idVendor = 0x2341
  idProduct = 0x0043
  bcdDevice = 0x0001
  iManufacturer = 0x0001  
  iProduct = 0x0002  
  iSerialNumber = 0x00dc  <75833353934351E05231>
  bNumConfigurations = 0x0001

...
As HPS noted in the first place check if you have valid permissions 
that allow you to read/write from/to usb device. I did a hint at the 
OpenOCD port:


/usr/ports/devel/openocd/pkg-message

To allow an ordinary user to acces any of the the hotplug USB
interface add him/her to the operator group  (pw groupmod operator -m
username), then setup the devfs subsystem by adding these lines to
the following files:

***/etc/devfs.rules: [localrules=10] add path 'ugen*' mode 0660 group
operator add path 'usb/*'  mode 0660 group operator add path 'usb'
mode 0770 group operator

***/etc/rc.conf: devfs_system_ruleset="localrules"


$ cat /etc/rc.conf | grep devfs
# allow local rules as specified in /etc/devfs.rules (5)
devfs_system_ruleset="localrules"

$ cat /etc/devfs.rules
# Allow operator group to mount USB devices
[localrules=5]
add path 'da*' mode 0660 group operator
# for arduino hotplug USB
add path 'ugen*' mode 0660 group operator
add path 'usb/*' mode 0660 group operator
add path 'usb' mode 0770 group operator

Do I need to restart after changing devfs.rules?
That would be a bit painful at the moment; already works for
devices like camera and usb sticks but they are da* devices.


I use MINICOM as the Terminal emulator. Type Ctrl+A then Z for
command menu. Note that you will have to create a configuration for a
given port in the first place (as root type `minicom -s /dev/cuaU0`
set valid port name and parameters then save as the default
configuration for that port).


I don't understand the need for MINICOM.  I currently use xterm.
Will that work for the print output?

I did not use that particular Arduino utility, but there may be a 
chance that it was written for Linux and it may suggest port name

like /dev/ttyUSB0 instead /dev/cuaU0 as it is used in FreeBSD.


The "Serial Port" menu item is greyed out, as if it found none.
When I plug in the arduino, there are 7 new entries in /dev:
$ diff dev_noarduino.txt dev_arduino.txt
29a30,32

cuaU0
cuaU0.init
cuaU0.lock

81a85,87

ttyU0
ttyU0.init
ttyU0.lock

106a113

ugen6.2


In general on FreeBSD COM port over USB (aka Virtual-COM-Port) is 
handled by `ucom` kernel module (type `kldstat` to list loaded

kernel modules), also it may use `umodem` or even `u3g` module. Those
modules are loaded by `devd` system daemon based on USB descriptors
when you plug a device. I just found a bug in pyOCD (Python module
for ARM CPU debug) that prevents running GDB Server when `ucom`
module is loaded for the VCP port on that board. pyOCD tries to
unload the kernel module by default to gain access to the VCP using
LibUSB but it lacks permissions to do so and the whole program stops
with an exception. In that case simply unload selected modules and
`service devd stop` for the time of testing. This may be also the
case for you: 1. You lack permissions to access a resource so
temporary try run as root and see if that works. 2. You may require
some component that is already taken by other service/application.


$ kldstat
Id Refs AddressSize Name
 1   13 0x8020 206c860  kernel
 21 0x8226e000 15cf0fuse.ko
 31 0x82421000 2408 ums.ko
 41 0x82424000 76cc tmpfs.ko
 51 0x8242c000 1bc0 umodem.ko
 61 0x8242e000 3c58 ucom.ko

I don't think I can run arduino as root as I can't connect to X as root;
do I need to reboot for the /etc/devfs.rules to take effect?
(will have to do some cleanup before trying that)

Thanks,

Gary


___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Problem reports for u...@freebsd.org that need special attention

2020-05-31 Thread bugzilla-noreply
To view an individual PR, use:
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=(Bug Id).

The following is a listing of current problems submitted by FreeBSD users,
which need special attention. These represent problem reports covering
all versions including experimental development code and obsolete releases.

Status  |Bug Id | Description
+---+---
Open|213877 | xhci reset causes panic on SuperMicro A1SRi-2758F 
Open|234578 | Support for Sierra Wireless EM7455 modem  
Open|237666 | repeated messages of "uhub_reattach_port: giving  

3 problems total for which you should take action.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: arduino usb/com port issue

2020-05-31 Thread Tomasz CEDRO
On Sun, May 31, 2020 at 7:54 PM Hans Petter Selasky wrote:
>
> On 2020-05-31 18:55, Gary Aitken wrote:
> > It's not clear to me if this is the right place for this or not; please
> > let me know if not.  I originally posted on questions and got no response.
> >
> > I installed the arduino package on an 11.3-RELEASE system.  When
> > it comes up, the Tools/Serial Port menu item is greyed out,
> > apparently because it doesn't know USB ports serve as com ports,
> > or for some reason it can't find them.  Is this something I need to
> > configure somehow?  Is this something that should be filed as a
> > bug?
> >
> > Thanks for any clues,
> >
>
> Did you check the permissions on /dev/usb/XXX ?
>
> And output from usbconfig
>
> --HPS

Hey Gary, Hey HPS :-)

I am using /dev/cuaU0 USB VCOM Port with success for years on FreeBSD,
even today it works fine with ARM DAPLink debug probe :-)

As HPS noted in the first place check if you have valid permissions
that allow you to read/write from/to usb device. I did a hint at the
OpenOCD port:

/usr/ports/devel/openocd/pkg-message

 To allow an ordinary user to acces any of the the hotplug USB interface
 add him/her to the operator group  (pw groupmod operator -m username), then
 setup the devfs subsystem by adding these lines to the following files:

 ***/etc/devfs.rules:
 [localrules=10]
add path 'ugen*' mode 0660 group operator
add path 'usb/*'  mode 0660 group operator
add path 'usb' mode 0770 group operator

 ***/etc/rc.conf:
devfs_system_ruleset="localrules"

I use MINICOM as the Terminal emulator. Type Ctrl+A then Z for command
menu. Note that you will have to create a configuration for a given
port in the first place (as root type `minicom -s /dev/cuaU0` set
valid port name and parameters then save as the default configuration
for that port).

I did not use that particular Arduino utility, but there may be a
chance that it was written for Linux and it may suggest port name like
/dev/ttyUSB0 instead /dev/cuaU0 as it is used in FreeBSD.

In general on FreeBSD COM port over USB (aka Virtual-COM-Port) is
handled by `ucom` kernel module (type `kldstat` to list loaded kernel
modules), also it may use `umodem` or even `u3g` module. Those modules
are loaded by `devd` system daemon based on USB descriptors when you
plug a device. I just found a bug in pyOCD (Python module for ARM CPU
debug) that prevents running GDB Server when `ucom` module is loaded
for the VCP port on that board. pyOCD tries to unload the kernel
module by default to gain access to the VCP using LibUSB but it lacks
permissions to do so and the whole program stops with an exception. In
that case simply unload selected modules and `service devd stop` for
the time of testing. This may be also the case for you:
1. You lack permissions to access a resource so temporary try run as
root and see if that works.
2. You may require some component that is already taken by other
service/application.

Note: It is not wise to run as root networked enabled applications
even though are "only meant" for electronics development, so try to
configure your system so it runs such applications without root :-)

Have fun! :-)
Tomek

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: arduino usb/com port issue

2020-05-31 Thread Hans Petter Selasky

On 2020-05-31 18:55, Gary Aitken wrote:

It's not clear to me if this is the right place for this or not; please
let me know if not.  I originally posted on questions and got no response.

I installed the arduino package on an 11.3-RELEASE system.  When
it comes up, the Tools/Serial Port menu item is greyed out,
apparently because it doesn't know USB ports serve as com ports,
or for some reason it can't find them.  Is this something I need to
configure somehow?  Is this something that should be filed as a
bug?

Thanks for any clues,



Did you check the permissions on /dev/usb/XXX ?

And output from usbconfig

--HPS

___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


arduino usb/com port issue

2020-05-31 Thread Gary Aitken

It's not clear to me if this is the right place for this or not; please
let me know if not.  I originally posted on questions and got no response.

I installed the arduino package on an 11.3-RELEASE system.  When
it comes up, the Tools/Serial Port menu item is greyed out,
apparently because it doesn't know USB ports serve as com ports,
or for some reason it can't find them.  Is this something I need to
configure somehow?  Is this something that should be filed as a
bug?

Thanks for any clues,

Gary
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"