Bug 251232 - devel/urjtag: broken - not working with usb devices
Summary: devel/urjtag: broken - not working with usb devices
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Yuri Victorovich
URL: https://sourceforge.net/p/urjtag/bugs...
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-18 06:32 UTC by Torfinn Ingolfsen
Modified: 2020-11-21 19:55 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (yuri)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Torfinn Ingolfsen 2020-11-18 06:32:07 UTC
latest urjtag in ports doesn't want to talk to usb devices. Installed from package on a 11.4 machine:
tingo@kg-core2$ uname -a
FreeBSD kg-core2.kg4.no 11.4-RELEASE-p3 FreeBSD 11.4-RELEASE-p3 #0: Tue Sep  1 08:22:33 UTC 2020     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

root@kg-core2# pkg info urjtag*
urjtag-2019.12
root@kg-core2# pkg options urjtag
urjtag - FTDI: on
urjtag - JEDEC: off
urjtag - NLS: on
urjtag - PYTHON: off
urjtag - USB: on

a DirtyJTAG adapter is correctly identified:
root@kg-core2# usbconfig -d ugen0.4
ugen0.4: <DirtyJTAG Jean THOMAS> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
root@kg-core2# ls -l /dev/ugen0.4 /dev/usb/0.4.0
lrwxr-xr-x  1 root  wheel         9 Nov  4 22:18 /dev/ugen0.4 -> usb/0.4.0
crw-rw----  1 root  operator  0x2d4 Nov  4 22:18 /dev/usb/0.4.0

and it has permissions so that my user can access it:
tingo@kg-core2$ groups tingo
tingo wheel operator video dialer cups

urjtag doesn't want to talk to the adapter
tingo@kg-core2$ jtag

UrJTAG 2019.12 #
Copyright (C) 2002, 2003 ETC s.r.o.
Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors

UrJTAG is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
There is absolutely no warranty for UrJTAG.

warning: UrJTAG may damage your hardware!
Type "quit" to exit, "help" for help.

jtag> cable dirtyjtag
error: Couldn't connect to suitable USB device.
jtag> quit
I also tried with sudo - no difference. I also tried building devel/urjtag from ports - no difference. The hardware is verified working (including the usb cable) on another machine running the same version of urjtag (but running on Linux).
Comment 1 Torfinn Ingolfsen 2020-11-18 06:38:29 UTC
Also tested on a machine running FreeBSD 12.2-release
root@kg-pod530:~ # freebsd-version -ku
12.2-RELEASE
12.2-RELEASE

# pkg info urjtag*
urjtag-2019.12

# jtag

UrJTAG 2019.12 #
Copyright (C) 2002, 2003 ETC s.r.o.
Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors

UrJTAG is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
There is absolutely no warranty for UrJTAG.

warning: UrJTAG may damage your hardware!
Type "quit" to exit, "help" for help.

jtag> cable dirtyjtag
error: Couldn't connect to suitable USB device.
jtag> quit

usbconfig confirms the usb adapter is present and detected correctly
# usbconfig ugen0.3 dump_device_desc
ugen0.3: <DirtyJTAG Jean THOMAS> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0110
  bDeviceClass = 0x00ff  <Vendor specific>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x1209
  idProduct = 0xc0ca
  bcdDevice = 0x0110
  iManufacturer = 0x0001  <DirtyJTAG>
  iProduct = 0x0002  <Jean THOMAS>
  iSerialNumber = 0x0003  <no serial :-)>
  bNumConfigurations = 0x0001
Comment 2 Torfinn Ingolfsen 2020-11-21 13:26:28 UTC
A fix has been found, see this post on FreeBSD forums: https://forums.freebsd.org/threads/devel-urjtag-broken-not-working.77596/post-485018
simply edit the ports Makefile and change the line
USB_CONFIGURE_ON=              --with-libusb=/usr
to
USB_CONFIGURE_ON=

then rebuild and reinstall the port. Test:
tingo@kg-core1$ jtag

UrJTAG 2019.12 #
Copyright (C) 2002, 2003 ETC s.r.o.
Copyright (C) 2007, 2008, 2009 Kolja Waschk and the respective authors

UrJTAG is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
There is absolutely no warranty for UrJTAG.

warning: UrJTAG may damage your hardware!
Type "quit" to exit, "help" for help.

jtag> bsdl path /home/tingo/doc/Altera/docs/fpga/bsdl/
jtag> cable dirtyjtag
jtag> detect
IR length: 10
Chain length: 1
Device Id: 00000010000011110001000011011101 (0x020F10DD)
  Filename:     /home/tingo/doc/Altera/docs/fpga/bsdl//EP4CE6E22.bsd
jtag> quit

I haven't teted the fix on FreeBSD 12.2-release yet.
Comment 3 Yuri Victorovich freebsd_committer 2020-11-21 18:32:54 UTC
Fix committed.

Thank you for reporting the problem and the fix!

Yuri
Comment 4 commit-hook freebsd_committer 2020-11-21 18:33:14 UTC
A commit references this bug:

Author: yuri
Date: Sat Nov 21 18:32:50 UTC 2020
New revision: 556008
URL: https://svnweb.freebsd.org/changeset/ports/556008

Log:
  devel/urjtag: Fix bug that libusb wasn't recognized

  PR:		251232
  Reported by:	Torfinn Ingolfsen <tingox+freebsd@gmail.com>
  MFH:		2020Q4

Changes:
  head/devel/urjtag/Makefile
Comment 5 commit-hook freebsd_committer 2020-11-21 19:55:24 UTC
A commit references this bug:

Author: yuri
Date: Sat Nov 21 19:54:45 UTC 2020
New revision: 556015
URL: https://svnweb.freebsd.org/changeset/ports/556015

Log:
  MFH: r556008

  devel/urjtag: Fix bug that libusb wasn't recognized

  PR:		251232
  Reported by:	Torfinn Ingolfsen <tingox+freebsd@gmail.com>

  Approved by:	ports-secteam (riggs)

Changes:
_U  branches/2020Q4/
  branches/2020Q4/devel/urjtag/Makefile