#! /bin/sh /usr/share/dpatch/dpatch-run
## 008-device_id.dpatch by Mario Fetka (geos_one) <mario.fetka@gmail.com>
##
## DP: add device_id to output
## DP: thx. to gentoo devs

@DPATCH@
--- megactl/src/adapter.c.orig	2017-04-22 17:15:55.068000000 +0200
+++ megactl/src/adapter.c	2017-04-22 17:17:17.624000000 +0200
@@ -193,9 +193,9 @@
 	d->id = info->slot;
 
 	if (d->channel == DISK_NOENC)
-	    snprintf (d->name, sizeof (d->name), "%se*s%u", a->name, d->id);
+	    snprintf (d->name, sizeof (d->name), "d%u%se*s%u", info->device_id, a->name, d->id);
 	else
-	    snprintf (d->name, sizeof (d->name), "%se%us%u", a->name, d->channel, d->id);
+	    snprintf (d->name, sizeof (d->name), "d%u%se%us%u", info->device_id, a->name, d->channel, d->id);
 
 	d->inquiry = info->inquiry.inq;
 	strncpy (d->vendor, d->inquiry.vendor_info, sizeof (d->vendor) - 1);