Re: bug with special bracket expressions in regular expressions

2013-09-02 Thread Damian Weber


On Mon, 2 Sep 2013, Andriy Gapon wrote:

 re_format(7) says:
  There are two special cases? of bracket expressions: the bracket expres?
  sions ?[[::]]? and ?[[::]]? match the null string at the beginning and
  end of a word respectively.  A word is defined as a sequence of word
  characters which is neither preceded nor followed by word characters.  A
  word character is an alnum character (as defined by ctype(3)) or an
  underscore.  This is an extension, compatible with but not specified by
  IEEE Std 1003.2 (?POSIX.2?), and should be used with caution in software
  intended to be portable to other systems.
 
 However I observe the following:
 $ echo cd0 cd1 xx | sed 's/cd[0-9][^ ]* *//g'
 xx
 $ echo cd0 cd1 xx | sed 's/[[::]]cd[0-9][^ ]* *//g'
 cd1 xx
 
 In my opinion '[[::]]' should not affect how the pattern is matched in this 
 case.
 
 Any thoughts, suggestions?

there are two simpler expressions, whose difference I don't understand either
(tested on 8.4-PRERELEASE)

$ echo cd0 cd1 xx | sed 's/cd[0-9] //g'
xx
$ echo cd0 cd1 xx | sed 's/[[::]]cd[0-9] //g'
cd1 xx

-- Damian

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


Re: umass, Verbatim STORE N GO drive, CAM status 0x50

2015-04-01 Thread Damian Weber

 Try adding some quirks:
 
 usbconfig dump_quirk_names | grep MSC
 
 --HPS

Dear Hans Petter and Kurt, thank you for your great advice,
I successfully attached my Verbatim USB drive

the magic lines are

in ./dev/usb/usbdevs :

+vendor VERBATIM0x18a5  Verbatim
+product VERBATIM STORENGO  0x0243  Verbatim Store N Go

in ./dev/usb/quirk/usb_quirk.c

/* copied from SANDISK, SDCZ2_128 */

+   USB_QUIRK(VERBATIM, STORENGO, 0x, 0x, UQ_MSC_FORCE_WIRE_BBB,
+   UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE,
+   UQ_MSC_NO_SYNC_CACHE),


result:
a) can mount it (mount_msdosfs)
b) can read/write files (sha1-checksums verified)

two questions remain

1) can the dmesg error messages be dealt with? ILLEGAL REQUEST asc:20,0

ugen2.2: Verbatim at usbus2
umass0: Verbatim STORE N GO, class 0/0, rev 2.10/1.00, addr 2 on usbus2
umass0:  SCSI over Bulk-Only; quirks = 0x4080
umass0:4:0: Attached to scbus4
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 
00 
(probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(probe0:umass-sim0:0:0:0): SCSI status: Check Condition
(probe0:umass-sim0:0:0:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid 
command operation code)
(probe0:umass-sim0:0:0:0): Error 22, Unretryable error
da0 at umass-sim0 bus 0 scbus4 target 0 lun 0
da0: Verbatim STORE N GO  Removable Direct Access SPC-4 SCSI device
da0: 40.000MB/s transfers
da0: 14909MB (30535401 512 byte sectors: 255H 63S/T 1900C)
da0: quirks=0x2NO_6_BYTE

2) is it possible to modify usb_quirk.c without 
   going through the whole make-kernel dance?


Best wishes

   Damian

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


Re: umass, Verbatim STORE N GO drive, CAM status 0x50

2015-03-29 Thread Damian Weber
 
  I did not find where the product ID goes ...
  is that everything I have to consider?
 
 At the end of sys/dev/usb/usbdevs you'll find the product IDs.

I tried and failed to get Verbatim Store N Go working.

This included the following attempts 

1) include the quirk UQ_MSC_NO_SYNC_CACHE
2) include the quirk UQ_MSC_NO_SYNC_CACHE and UQ_MSC_NO_TEST_UNIT_READY
3) I found 
   http://randominfo.pyret.net/index.php?controller=postaction=viewid_post=10
   where some Verbatim Store N Go worked with quirks=0x2NO_6_BYTE
   but there is no NO_6_BYTE quirk in dev/usb/quirk/usb_quirk.c

   instead I found a NO_6_BYTE quirk in cam/scsi/scsi_da.c so I changed
   scsi_da.c, as follows

--- ./cam/scsi/scsi_da.c.orig   2015-03-28 21:33:12.001813000 +0100
+++ ./cam/scsi/scsi_da.c2015-03-28 21:37:24.196604000 +0100
@@ -413,6 +413,14 @@
},
{
/*
+* Verbatim Verbatim STORE N GO
+* dwe...@htwsaar.de
+*/
+   {T_DIRECT, SIP_MEDIA_REMOVABLE, Verbatim, *,
+   *}, /*quirks*/ DA_Q_NO_6_BYTE
+   },
+   {
+   /*
 * Sigmatel USB Flash MP3 Player
 * PR: kern/57046
 */

 so in that case, the scsi_da.c quirk and the usb_quirk.c-quirks
 were in place, resulting in failed to attach to device

4) I removed the usb_quirks from the picture, leaving only the 
   scsi_da.c quirk (NO_6_BYTE) in place, the result being the 
   output below


ugen2.2: Verbatim at usbus2
umass0: Verbatim STORE N GO, class 0/0, rev 2.10/1.00, addr 2 on usbus2
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:4:0: Attached to scbus4
Trying to mount root from ufs:/dev/ada0p2 [rw]...
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 00

(probe0:umass-sim0:0:0:0): CAM status: Auto-Sense Retrieval Failed
(probe0:umass-sim0:0:0:0): Error 5, Unretryable error
(da0:umass-sim0:0:0:0): got CAM status 0x50
(da0:umass-sim0:0:0:0): fatal error, failed to attach to device

= = == 

anything I should try next?

Below the patches I tried, the version 4) being active,
version 3) commented out with a #if 0 ... #endif

Best wishes

Damian

= = ==

kernel patches of system FreeBSD 11.0-CURRENT #4 r280370M as of Sun Mar 29 
12:06:02 CEST 2015
--- ./cam/scsi/scsi_da.c.orig   2015-03-28 21:33:12.001813000 +0100
+++ ./cam/scsi/scsi_da.c2015-03-28 21:37:24.196604000 +0100
@@ -413,6 +413,14 @@
},
{
/*
+* Verbatim Verbatim STORE N GO
+* dwe...@htwsaar.de
+*/
+   {T_DIRECT, SIP_MEDIA_REMOVABLE, Verbatim, *,
+   *}, /*quirks*/ DA_Q_NO_6_BYTE
+   },
+   {
+   /*
 * Sigmatel USB Flash MP3 Player
 * PR: kern/57046
 */

--- ./dev/usb/quirk/usb_quirk.c.orig2015-03-28 16:15:07.980503000 +0100
+++ ./dev/usb/quirk/usb_quirk.c 2015-03-29 10:42:14.931664000 +0200
@@ -523,6 +523,9 @@
USB_QUIRK(FEIYA, DUMMY, 0x, 0x, UQ_MSC_NO_SYNC_CACHE, 
UQ_MATCH_VENDOR_ONLY),
USB_QUIRK(REALTEK, DUMMY, 0x, 0x, UQ_MSC_NO_SYNC_CACHE, 
UQ_MATCH_VENDOR_ONLY),
USB_QUIRK(INITIO, DUMMY, 0x, 0x, UQ_MSC_NO_SYNC_CACHE, 
UQ_MATCH_VENDOR_ONLY),
+#if 0 /* didn't work, we try patching ./cam/scsi/scsi_da.c */
+   USB_QUIRK(VERBATIM, STORENGO, 0x, 0x, UQ_MSC_NO_SYNC_CACHE, 
UQ_MSC_NO_TEST_UNIT_READY, UQ_MATCH_VENDOR_ONLY),
+#endif
 };
 #undef USB_QUIRK_VP
 #undef USB_QUIRK

--- ./dev/usb/usbdevs.orig  2015-03-28 15:55:34.870376000 +0100
+++ ./dev/usb/usbdevs   2015-03-28 16:27:37.709561000 +0100
@@ -689,6 +689,7 @@
 vendor DISPLAYLINK 0x17e9  DisplayLink
 vendor LENOVO  0x17ef  Lenovo
 vendor WAVESENSE   0x17f4  WaveSense
+vendor VERBATIM0x18a5  Verbatim
 vendor VAISALA 0x1843  Vaisala
 vendor AMIT0x18c5  AMIT
 vendor GOOGLE  0x18d1  Google
@@ -4467,6 +4468,9 @@
 /* Vaisala products */
 product VAISALA CABLE  0x0200  USB Interface cable
 
+/* Verbatim products */
+product VERBATIM STORENGO  0x0243  Verbatim Store N Go
+
 /* Vertex products */
 product VERTEX VW110L  0x0100  Vertex VW110L modem
 


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


umass, Verbatim STORE N GO drive, CAM status 0x50

2015-03-28 Thread Damian Weber



Dear all,

on a 11-current system I tried a VERBATIM usb drive which does
not produce a /dev/da... entry. My question is whether this can
be fixed by adding an entry in some array within the kernel source
(header files?) or is this bad hardware for which a workaround 
implementation is needed.

system is 
FreeBSD 11.0-CURRENT (VENUS) #0 r280370: Mon Mar 23 22:14:14 CET 2015

relevant dmesg entries when inserting the drive:

umass0: Verbatim STORE N GO, class 0/0, rev 2.10/1.00, addr 2 on usbus2
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:4:0: Attached to scbus4
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 
00 
(probe0:umass-sim0:0:0:0): CAM status: Auto-Sense Retrieval Failed
(probe0:umass-sim0:0:0:0): Error 5, Unretryable error
(da0:umass-sim0:0:0:0): got CAM status 0x50
(da0:umass-sim0:0:0:0): fatal error, failed to attach to device

the device gets recognized as ugen2.2 as seen by the timestamp below
# ls -ld ug*

lrwxr-xr-x  1 root  wheel  9 Mar 28 13:41 ugen0.1@ - usb/0.1.0
lrwxr-xr-x  1 root  wheel  9 Mar 28 13:41 ugen1.1@ - usb/1.1.0
lrwxr-xr-x  1 root  wheel  9 Mar 28 13:41 ugen2.1@ - usb/2.1.0
lrwxr-xr-x  1 root  wheel  9 Mar 28 13:44 ugen2.2@ - usb/2.2.0
...

and of course usbconfig writes the ugen2.2 configuration
ugen2.2: STORE N GO Verbatim at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=ON (2mA)

what follows is the full dmesg output, and the complete usbconfig output

what do you recommend?

Best wishes

   Damian

--

Copyright (c) 1992-2015 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.0-CURRENT #0 r280370: Mon Mar 23 22:14:14 CET 2015
root@venus.local:/usr/obj/usr/src/sys/VENUS amd64
FreeBSD clang version 3.6.0 (tags/RELEASE_360/final 230434) 20150225
WARNING: WITNESS option enabled, expect reduced performance.
CPU: Intel(R) Core(TM)2 CPU  6300  @ 1.86GHz (1862.06-MHz K8-class CPU)
  Origin=GenuineIntel  Id=0x6f2  Family=0x6  Model=0xf  Stepping=2
  
Features=0xbfebfbffFPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE
  Features2=0xe3bdSSE3,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM
  AMD Features=0x20100800SYSCALL,NX,LM
  AMD Features2=0x1LAHF
  VT-x: HLT,PAUSE
  TSC: P-state invariant, performance statistics
real memory  = 2147483648 (2048 MB)
avail memory = 2038140928 (1943 MB)
Event timer LAPIC quality 400
ACPI APIC Table: PTLTD  APIC  
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
ioapic0 Version 2.0 irqs 0-23 on motherboard
random: entropy device infrastructure driver
random: selecting highest priority adaptor Dummy
kbd1 at kbdmux0
netmap: loaded module
random: SOFT: yarrow init()
random: selecting highest priority adaptor Yarrow
acpi0: PTLTD   RSDT on motherboard
acpi0: Power Button (fixed)
cpu0: ACPI CPU on acpi0
cpu1: ACPI CPU on acpi0
atrtc0: AT realtime clock port 0x70-0x71 irq 8 on acpi0
Event timer RTC frequency 32768 Hz quality 0
attimer0: AT timer port 0x40-0x43 irq 0 on acpi0
Timecounter i8254 frequency 1193182 Hz quality 0
Event timer i8254 frequency 1193182 Hz quality 100
hpet0: High Precision Event Timer iomem 0xfed0-0xfed003ff on acpi0
Timecounter HPET frequency 14318180 Hz quality 950
Event timer HPET frequency 14318180 Hz quality 450
Event timer HPET1 frequency 14318180 Hz quality 440
Event timer HPET2 frequency 14318180 Hz quality 440
Timecounter ACPI-fast frequency 3579545 Hz quality 900
acpi_timer0: 24-bit timer at 3.579545MHz port 0x1008-0x100b on acpi0
acpi_button0: Power Button on acpi0
pcib0: ACPI Host-PCI bridge port 0xcf8-0xcff on acpi0
pci0: ACPI PCI bus on pcib0
pcib1: ACPI PCI-PCI bridge irq 16 at device 1.0 on pci0
pci1: ACPI PCI bus on pcib1
vgapci0: VGA-compatible display mem 
0xd100-0xd1ff,0xc000-0xcfff,0xd000-0xd0ff irq 16 at 
device 0.0 on pci1
vgapci0: Boot video device
uhci0: Intel 82801H (ICH8) USB controller USB-D port 0x1820-0x183f irq 20 at 
device 26.0 on pci0
usbus0 on uhci0
uhci1: Intel 82801H (ICH8) USB controller USB-E port 0x1840-0x185f irq 18 at 
device 26.1 on pci0
usbus1 on uhci1
ehci0: Intel 82801H (ICH8) USB 2.0 controller USB2-B mem 
0xd2305000-0xd23053ff irq 18 at device 26.7 on pci0
usbus2: EHCI version 1.0
usbus2 on ehci0
hdac0: Intel 82801H HDA Controller mem 0xd230-0xd2303fff irq 20 at device 
27.0 on pci0
pcib2: ACPI PCI-PCI bridge irq 23 at device 28.0 on pci0
pcib2: failed to allocate initial I/O port window: 0-0xfff
pcib2: failed to allocate initial memory window: 0-0xf
pcib2: failed to allocate initial prefetch window: 0-0xf
pci3: ACPI PCI bus on pcib2
pcib3: ACPI PCI-PCI bridge irq 21 at device 28.5 on pci0

Re: umass, Verbatim STORE N GO drive, CAM status 0x50

2015-03-28 Thread Damian Weber


 Date: Sat, 28 Mar 2015 15:36:01
 From: Hans Petter Selasky h...@selasky.org
 To: Damian Weber dwe...@htwsaar.de, freebsd-current@freebsd.org
 Subject: Re: umass, Verbatim STORE N GO drive, CAM status 0x50
 
 On 03/28/15 15:06, Damian Weber wrote:
  what do you recommend?
 
 Try adding some quirks:
 
 usbconfig dump_quirk_names | grep MSC
 
 --HPS
 
 


thanks for the hint, dumping device description gives

 # usbconfig -u 2 -a 2 dump_device_desc
ugen2.2: STORE N GO Verbatim at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=ON (2mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0210 
  bDeviceClass = 0x  Probed by interface class
  bDeviceSubClass = 0x
  bDeviceProtocol = 0x   
  bMaxPacketSize0 = 0x0040 
  idVendor = 0x18a5 
  idProduct = 0x0243  
  bcdDevice = 0x0100 
  iManufacturer = 0x0001  Verbatim
  iProduct = 0x0002  STORE N GO
  iSerialNumber = 0x0003  1258013C
  bNumConfigurations = 0x0001 


in order to ensure I understood it correctly 

[ 0) no umass kernel module here  ]

1) new entry for Vendor VERBATIM in
sys/dev/usb/usbdevs
with vendor id 0x18a5

2) new entry in the sys/dev/usb/quirk/usb_quirk.c below 

/* Quirks for manufacturers which USB devices does not respond */

  USB_QUIRK(VERBATIM, DUMMY, 0x, 0x, UQ_MSC_NO_SYNC_CACHE, UQ_MATC
H_VENDOR_ONLY),

(the , after the last entry is a bit irritating)

most of these entries have UQ_MSC_NO_SYNC_CACHE - if that
doesn't work, I'll try UQ_MSC_NO_TEST_UNIT_READY which is
the only other option within that does not respond-section

3) make kernel

4) reboot

I did not find where the product ID goes ...
is that everything I have to consider?

Thanks a lot

   Damian


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


Re: umass, Verbatim STORE N GO drive, CAM status 0x50

2015-04-01 Thread Damian Weber


On Wed, 1 Apr 2015, Hans Petter Selasky wrote:

 Date: Wed, 1 Apr 2015 16:38:03
 From: Hans Petter Selasky h...@selasky.org
 To: Damian Weber dwe...@htwsaar.de, Kurt Jaeger li...@opsec.eu
 Cc: freebsd-current@freebsd.org
 Subject: Re: umass, Verbatim STORE N GO drive, CAM status 0x50
 
 On 04/01/15 16:27, Damian Weber wrote:
  
   Try adding some quirks:
   
   usbconfig dump_quirk_names | grep MSC
   
   --HPS
  
  Dear Hans Petter and Kurt, thank you for your great advice,
  I successfully attached my Verbatim USB drive
  
  the magic lines are
  
  in ./dev/usb/usbdevs :
  
  +vendor VERBATIM0x18a5  Verbatim
  +product VERBATIM STORENGO  0x0243  Verbatim Store N Go
  
  in ./dev/usb/quirk/usb_quirk.c
  
  /* copied from SANDISK, SDCZ2_128 */
  
  +   USB_QUIRK(VERBATIM, STORENGO, 0x, 0x, UQ_MSC_FORCE_WIRE_BBB,
  +   UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE,
  +   UQ_MSC_NO_SYNC_CACHE),
  
  
  result:
  a) can mount it (mount_msdosfs)
  b) can read/write files (sha1-checksums verified)
  
  two questions remain
  
  1) can the dmesg error messages be dealt with? ILLEGAL REQUEST asc:20,0
  
  ugen2.2: Verbatim at usbus2
  umass0: Verbatim STORE N GO, class 0/0, rev 2.10/1.00, addr 2 on usbus2
  umass0:  SCSI over Bulk-Only; quirks = 0x4080
  umass0:4:0: Attached to scbus4
  (probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10
  00 00
  (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
  (probe0:umass-sim0:0:0:0): SCSI status: Check Condition
  (probe0:umass-sim0:0:0:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid
  command operation code)
  (probe0:umass-sim0:0:0:0): Error 22, Unretryable error
  da0 at umass-sim0 bus 0 scbus4 target 0 lun 0
  da0: Verbatim STORE N GO  Removable Direct Access SPC-4 SCSI device
  da0: 40.000MB/s transfers
  da0: 14909MB (30535401 512 byte sectors: 255H 63S/T 1900C)
  da0: quirks=0x2NO_6_BYTE
  
  2) is it possible to modify usb_quirk.c without
  going through the whole make-kernel dance?
  
 
 Hi,
 
 If usb_quirk is built like a module you only rebuild that and load.
 
 Can you put this quirk and patch in a PR and assign to me and I'll get it in!
 
 --HPS
 

PR filed as Bug 199101 has been added to the database

Email sent to:
freebsd-...@freebsd.org 


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