Add --brief and --dereference to file(1)

2015-12-20 Thread Ralf Horstmann
Hi,

xdg-open uses "xdg-mime query filetype" to find out the mime type of a given
file. Depending on the desktop environment, xdg-mime uses different backends.
In my case (i3 wm) it falls back to the generic code path, which uses

file --brief --dereference --mime-type

Since --brief and --dereference are not recognized, xdg-mime returns an empty
mime type and causes xdg-open to open the given file with a browser instead of
using the preferred application.

The following patch adds --brief and --dereference to file(1) to address this.

Regards,
Ralf

Index: usr.bin/file/file.1
===
RCS file: /usr/cvs/openbsd/src/usr.bin/file/file.1,v
retrieving revision 1.43
diff -u -u -r1.43 file.1
--- usr.bin/file/file.1 30 Jul 2015 11:13:24 -  1.43
+++ usr.bin/file/file.1 20 Dec 2015 11:13:37 -
@@ -83,7 +83,7 @@
 .Pp
 The options are as follows:
 .Bl -tag -width indent
-.It Fl b
+.It Fl b , -brief
 Does not prepend filenames to output lines.
 .It Fl c
 Prints a summary of the parsed magic file; usually used for debugging.
@@ -97,7 +97,7 @@
 .Dq text/plain
 rather than
 .Dq ASCII text .
-.It Fl L
+.It Fl L , -dereference
 Causes symlinks to be followed.
 .It Fl s
 Attempts to read block and character device files, not just regular files.
Index: usr.bin/file/file.c
===
RCS file: /usr/cvs/openbsd/src/usr.bin/file/file.c,v
retrieving revision 1.56
diff -u -u -r1.56 file.c
--- usr.bin/file/file.c 5 Dec 2015 13:18:09 -   1.56
+++ usr.bin/file/file.c 20 Dec 2015 10:50:21 -
@@ -102,9 +102,11 @@
 static FILE*magicfp;
 
 static struct option longopts[] = {
-   { "mime",  no_argument, NULL, 'i' },
-   { "mime-type", no_argument, NULL, 'i' },
-   { NULL,0,   NULL, 0   }
+   { "brief",   no_argument, NULL, 'b' },
+   { "dereference", no_argument, NULL, 'L' },
+   { "mime",no_argument, NULL, 'i' },
+   { "mime-type",   no_argument, NULL, 'i' },
+   { NULL,  0,   NULL, 0   }
 };
 
 __dead void



Re: inteldrm(4) diff that needs testing

2015-10-25 Thread Ralf Horstmann
* Jonathan Gray  [2015-10-25 05:51]:
> On Sat, Oct 24, 2015 at 11:48:01PM +0200, Mark Kettenis wrote:
> > The diff below makes inteldrm(4) attach directly to pci(4) instead of
> > vga(1).  Because inteldrm(4) depends on intagp(4), this also make
> > intagp(4) a child of inteldrm(4).  Ultimately I'd like to integrate
> > intagp(4) into inteldrm(4), but that's going to be a bit more work.
> > 
> > This diff is needed to make inteldrm(4) work when OpenBSD gets booted
> > by UEFI firmware.  It will also make inteldrm(4) work on machines with
> > discrete graphics.
> > 
> > This diff needs to be tested on a wide range of hardware.  So if you
> > have a machine with inteldrm(4), please give it a shot.  I'm
> > particularly interested in testing on an x40.
> 
> x40 before the diff:
> 
> vga1 at pci0 dev 2 function 0 "Intel 82855GM Video" rev 0x02
> intagp0 at vga1
> agp0 at intagp0: aperture at 0xe000, size 0x800
> inteldrm0 at vga1
> drm0 at inteldrm0
> inteldrm0: apic 1 int 16
> inteldrm0: 1024x768
> wsdisplay0 at vga1 mux 1: console (std, vt100 emulation)
> wsdisplay0: screen 1-5 added (std, vt100 emulation)
> "Intel 82855GM Video" rev 0x02 at pci0 dev 2 function 1 not configured
> 
> after with serial console:
> 
> inteldrm0 at pci0 dev 2 function 0 "Intel 82855GM Video" rev 0x02
> intagp0 at inteldrm0
> agp0 at intagp0: aperture at 0xe000, size 0x800
> drm0 at inteldrm0
> inteldrm0: can't map mmio space
> inteldrm1 at pci0 dev 2 function 1 "Intel 82855GM Video" rev 0x02
> intagp at inteldrm1 not configured
> drm1 at inteldrm1
> inteldrm1: couldn't map interrupt
> Memory manager not clean. Delaying takedown
> 
> video mode doesn't switch and can't change to vt, goes multiuser and can
> login via ssh.
> 
> With glass console it hangs after "root on wd0a" with no mode switch.

I see similar behaviour on an Asus i386 laptop with 855GM. It stops after
"root on wd0a". No video mode switch during boot and no ssh login possible, but
ddb still works. See dmesg below without and with patch applied.

Regards,
Ralf

OpenBSD 5.8-current (GENERIC) #1278: Tue Oct 20 09:46:53 MDT 2015
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel(R) Pentium(R) M processor 1400MHz ("GenuineIntel" 686-class) 1.41 
GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,TM,PBE,EST,TM2,PERF
real mem  = 527187968 (502MB)
avail mem = 504582144 (481MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 03/08/04, SMBIOS rev. 2.3 @ 0xf5620 (37 entries)
bios0: vendor American Megatrends Inc. version "0208" date 03/08/2004
bios0: ASUSTeK Computer Inc. M2N
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP OEMB
acpi0: wakeup devices P0P1(S4) LAN0(S4) CBS0(S3) CBS1(S3) P394(S3) MODM(S3) 
USB1(S3) USB2(S3) USB3(S3) EHCI(S3) SLPB(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpi0: WARNING EC not initialized
acpi0: WARNING EC not initialized
acpi0: WARNING EC not initialized
acpi0: WARNING EC not initialized
acpi0: WARNING EC not initialized
acpi0: WARNING EC not initialized
acpi0: WARNING EC not initialized
acpi0: WARNING EC not initialized
acpi0: WARNING EC not initialized
acpi0: WARNING EC not initialized
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (P0P1)
acpiec0 at acpi0
acpicpu0 at acpi0: !C3(@101 io@0xe415), !C2(@1 io@0xe414), C1(@1 halt!), PSS
acpitz0 at acpi0: critical temperature is 110 degC
acpipwrres0 at acpi0: GFAN, resource for SBRG, FN00
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT0 model "M2N" serial   type LIon oem "ASUSTEK"
acpibtn0 at acpi0: SLPB
acpibtn1 at acpi0: LID_
acpiasus at acpi0 not configured
bios0: ROM list: 0xc/0xd200! 0xcd800/0x1000
cpu0 at mainbus0: (uniprocessor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: Enhanced SpeedStep 1401 MHz: speeds: 1400, 1400, 1400, 1400, 1400, 1400, 
1200, 1000, 800, 600 MHz
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82855GM Host" rev 0x02
"Intel 82855GM Memory" rev 0x02 at pci0 dev 0 function 1 not configured
"Intel 82855GM Config" rev 0x02 at pci0 dev 0 function 3 not configured
vga1 at pci0 dev 2 function 0 "Intel 82855GM Video" rev 0x02
intagp0 at vga1
agp0 at intagp0: aperture at 0xf000, size 0x800
inteldrm0 at vga1
drm0 at inteldrm0
inteldrm0: irq 5
inteldrm0: 1024x768
wsdisplay0 at vga1 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
"Intel 82855GM Video" rev 0x02 at pci0 dev 2 function 1 not configured
uhci0 at pci0 dev 29 function 0 "Intel 82801DB USB" rev 0x03: irq 5
uhci1 at pci0 dev 29 function 1 "Intel 82801DB USB" rev 0x03: irq 5
uhci2 at pci0 dev 29 function 2 "Intel 82801DB USB" rev 0x03: irq 5
ehci0 at pci0 dev 29 function 7 "Intel 82801DB USB" rev 0x03: irq 4
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
ppb0 at 

Re: call for testing: MSI for msk(4)

2014-09-23 Thread Ralf Horstmann
* Martin Pieuchot mpieuc...@nolizard.org [2014-09-23 22:20]:
 On 23/09/14(Tue) 13:58, Brad Smith wrote:
  On 31/12/13 12:06 AM, Brad Smith wrote:
  On 16/05/13 5:55 PM, Jérémie Courrèges-Anglas wrote:
  Hi,
  
  I've been using msk(4) with MSI on my laptop since a few days, with no
  apparent problem.
  
  mskc0 at pci2 dev 0 function 0 Marvell Yukon 88E8040 rev 0x13,
  Yukon-2 FE+ rev. A0 (0x0): msi
  msk0 at mskc0 port A: address 00:24:54:xx:xx:xx
  eephy0 at msk0 phy 0: 88E3016 10/100 PHY, rev. 0
  
  Other systems all seem to use MSI, but it would be cool if people with
  different chips could test it.
  
  Any other msk(4) users? It has also been tested with EC 8052/EC Ultra
  8058 controllers and working. I don't see any indication of any issues
  or errata regarding MSI operation in either of the FreeBSD or Linux
  drivers.
  
  Fast Ethernet controller..
  
  mskc0 at pci3 dev 0 function 0 Marvell Yukon 88E8036 rev 0x16, Yukon-2
  FE rev. A1 (0x1): msi
  msk0 at mskc0 port A: address 00:13:a9:fa:5a:52
  eephy0 at msk0 phy 0: 88E3082 10/100 PHY, rev. 3
  
  Gigabit controllers..
  
  mskc0 at pci3 dev 0 function 0 Marvell Yukon 88E8058 rev 0x13, Yukon-2 EC
  Ultra rev. B0 (0x3): msi
  msk0 at mskc0 port A: address 00:1b:63:ad:0b:ee
  eephy0 at msk0 phy 0: 88E1149 Gigabit PHY, rev. 1
  
  mskc0 at pci2 dev 0 function 0 Marvell Yukon 88E8053 rev 0x20, Yukon-2 EC
  rev. A3 (0x2): msi
  msk0 at mskc0 port A: address 00:50:43:00:7b:46
  eephy0 at msk0 phy 0: 88E Gigabit PHY, rev. 2
  
  mskc0 at pci3 dev 0 function 0 Marvell Yukon 88E8052 rev 0x21, Yukon-2
  EC rev. A3 (0x2): msi
  msk0 at mskc0 port A: address 00:18:f3:6c:44:da
  eephy0 at msk0 phy 0: 88E Gigabit PHY, rev. 2
  
  
  At this point I'd like to see this commited for wider spread testng
  and if anything does come up as usual it can be reverted.
 
 I agree.

Another Gigabit controller that works so far:

mskc0 at pci1 dev 0 function 0 Marvell Yukon 88E8055 rev 0x12, Yukon-2 EC 
Ultra rev. A1 (0x2): msi
msk0 at mskc0 port A: address 00:17:42:41:a8:2d
eephy0 at msk0 phy 0: 88E1149 Gigabit PHY, rev. 1

Cheers,
Ralf




Add usb quirk for Microchip PICkit2

2013-03-29 Thread Ralf Horstmann
Hi,

the following diff adds a quirk for PICkit2 microcontroller programmer to
prevent it from attaching as hid device. Makes PICkit2 work for me with pk2cmd
on i386. Also change the vendor ID 0x04d8 from Ituner to Microchip according to
http://www.linux-usb.org/usb.ids

Regards,
Ralf

Index: usb_quirks.c
===
RCS file: /usr/cvs/openbsd/src/sys/dev/usb/usb_quirks.c,v
retrieving revision 1.68
diff -u -u -r1.68 usb_quirks.c
--- usb_quirks.c8 Mar 2013 02:21:43 -   1.68
+++ usb_quirks.c29 Mar 2013 20:29:10 -
@@ -146,13 +146,14 @@
  { USB_VENDOR_HP, USB_PRODUCT_HP_R1500G2,  ANY,{ UQ_BAD_HID }},
  { USB_VENDOR_HP, USB_PRODUCT_HP_T750G2,   ANY,{ UQ_BAD_HID }},
  { USB_VENDOR_IDOWELL, USB_PRODUCT_IDOWELL_IDOWELL,ANY,{ UQ_BAD_HID }},
- { USB_VENDOR_ITUNER, USB_PRODUCT_ITUNER_USBLCD20x2,   ANY,{ UQ_BAD_HID }},
  { USB_VENDOR_LIEBERT, USB_PRODUCT_LIEBERT_UPS,ANY,{ 
UQ_BAD_HID }},
  { USB_VENDOR_LIEBERT2, USB_PRODUCT_LIEBERT2_PSA,  ANY,{ UQ_BAD_HID }},
  { USB_VENDOR_MECANIQUE, USB_PRODUCT_MECANIQUE_WISPY,  ANY,{ UQ_BAD_HID }},
  { USB_VENDOR_METAGEEK, USB_PRODUCT_METAGEEK_WISPY24I, ANY,{ UQ_BAD_HID }},
  { USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS1,   ANY,{ UQ_BAD_HID }},
  { USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS2,   ANY,{ UQ_BAD_HID }},
+ { USB_VENDOR_MICROCHIP, USB_PRODUCT_MICROCHIP_PICKIT2,ANY,{ 
UQ_BAD_HID }},
+ { USB_VENDOR_MICROCHIP, USB_PRODUCT_MICROCHIP_USBLCD20x2, ANY,{ 
UQ_BAD_HID }},
  { USB_VENDOR_MUSTEK2, USB_PRODUCT_MUSTEK2_PM800,  ANY,{ UQ_BAD_HID }},
  { USB_VENDOR_OMRON, USB_PRODUCT_OMRON_BX35F,  ANY,{ UQ_BAD_HID }},
  { USB_VENDOR_OMRON, USB_PRODUCT_OMRON_BX50F,  ANY,{ UQ_BAD_HID }},
Index: usbdevs
===
RCS file: /usr/cvs/openbsd/src/sys/dev/usb/usbdevs,v
retrieving revision 1.598
diff -u -u -r1.598 usbdevs
--- usbdevs 7 Mar 2013 23:39:14 -   1.598
+++ usbdevs 26 Mar 2013 17:03:16 -
@@ -138,7 +138,7 @@
 vendor DIGI2   0x04d0  Digi
 vendor ITTCANON0x04d1  ITT Canon
 vendor ALTEC   0x04d2  Altec Lansing
-vendor ITUNER  0x04d8  Ituner
+vendor MICROCHIP   0x04d8  Microchip
 vendor HOLTEK  0x04d9  Holtek
 vendor PANASONIC   0x04da  Panasonic (Matsushita)
 vendor SHARP   0x04dd  Sharp
@@ -,9 +,6 @@
 /* iTegno products */
 product ITEGNO WM1080A 0x1080  WM1080A
 
-/* Ituner (mini-box.com) products */
-product ITUNER USBLCD20x2  0x0002  USB-LCD-20x2
-
 /* Jablotron products */
 product JABLOTRON PC60B0x0001  PC-60B
 
@@ -2812,6 +2809,10 @@
 product MSI AX88772A   0xa877  AX88772A
 product MSI BLUETOOTH_20xa970  Bluetooth
 product MSI BLUETOOTH_30xa97a  Bluetooth
+
+/* Microchip Technology, Inc. products */
+product MICROCHIP USBLCD20x2   0x0002  USB-LCD-20x2
+product MICROCHIP PICKIT2  0x0033  PICkit2 Microcontroller Programmer
 
 /* Microdia / Sonix Techonology Co., Ltd. products */
 product MICRODIA YUREX 0x1010  YUREX




Re: test diff: unmap needs flags

2012-05-09 Thread Ralf Horstmann
Hi,

works on hppa as well:

OpenBSD 5.1-current (GENERIC) #0: Sat Feb 14 02:49:09 CET 1953
ralf@hppa.internal:/usr/src/sys/arch/hppa/compile/GENERIC
HP 9000/712/80 (King Gecko) PA-RISC 1.1c

Cheers,
Ralf



Re: test diff: unmap needs flags

2012-05-08 Thread Ralf Horstmann
Hi,

compiles and boots on alpha:

uvm_km_kmem_grow: grown to 0xfe001000
OpenBSD 5.1-current (GENERIC) #0: Tue May  8 02:12:19 CEST 2012
root@alpha.internal:/usr/src/sys/arch/alpha/compile/GENERIC
AlphaStation 255/300, 298MHz
8192 byte page size, 1 processor.
real mem = 268435456 (256MB)
rsvd mem = 2048000 (1MB)
avail mem = 253272064 (241MB)
mainbus0 at root
cpu0 at mainbus0: ID 0 (primary), 21064A-0 (unknown minor type 0)

Cheers,
Ralf