+/*
+ * Conversion from "HP DCE" to almost-normal DCE: on the 638 8-port mux,
+ * the distribution panel uses "HP DCE" conventions. If requested via
+ * the device flags, we swap the inputs to something closer to normal DCE,
+ * allowing a straight-through cable to a DTE or a reversed cable
+ * to a DCE (reversing 2-3, 4-5, 8-20 and leaving 6 unconnected;
+ * this gets "DCD" on pin 20 and "CTS" on 4, but doesn't connect
+ * DSR or make RTS work, though). The following gives the full
+ * details of a cable from this mux panel to a modem:
+ *
+ * HP modem
+ * name pin pin name
+ * HP inputs:
+ * "Rx" 2 3 Tx
+ * CTS 4 5 CTS (only needed for CCTS_OFLOW)
+ * DCD 20 8 DCD
+ * "DSR" 9 6 DSR (unneeded)
+ * RI 22 22 RI (unneeded)
+ *
+ * HP outputs:
+ * "Tx" 3 2 Rx
+ * "DTR" 6 not connected
+ * "RTS" 8 20 DTR
+ * "SR" 23 4 RTS (often not needed)
+ */
+#define FLAG_STDDCE 0x10 /* map inputs if this bit is set in flags */
+#define hp2dce_in(ibits) (iconv[(ibits) & 0xf])
+static char iconv[16] = {
+ 0, MI_DM, MI_CTS, MI_CTS|MI_DM,
+ MI_CD, MI_CD|MI_DM, MI_CD|MI_CTS, MI_CD|MI_CTS|MI_DM,
+ MI_RI, MI_RI|MI_DM, MI_RI|MI_CTS, MI_RI|MI_CTS|MI_DM,
+ MI_RI|MI_CD, MI_RI|MI_CD|MI_DM, MI_RI|MI_CD|MI_CTS,
+ MI_RI|MI_CD|MI_CTS|MI_DM
+};
+