Skip to content

Instantly share code, notes, and snippets.

@adukot
Last active May 14, 2016 18:13
Show Gist options
  • Save adukot/45f38aef6ad047372a82 to your computer and use it in GitHub Desktop.
Save adukot/45f38aef6ad047372a82 to your computer and use it in GitHub Desktop.
uchcom
--- uchcom.c.orig 2015-05-17 07:53:32.000000000 +0000
+++ uchcom.c 2015-05-17 07:59:58.000000000 +0000
@@ -101,7 +101,7 @@
#define UCHCOM_BRK1_MASK 0x01
#define UCHCOM_BRK2_MASK 0x40
-
+#if 0
#define UCHCOM_LCR1_MASK 0xAF
#define UCHCOM_LCR2_MASK 0x07
#define UCHCOM_LCR1_PARENB 0x80
@@ -109,11 +109,15 @@
#define UCHCOM_LCR2_PARODD 0x06
#define UCHCOM_LCR2_PARMARK 0x05
#define UCHCOM_LCR2_PARSPACE 0x04
-
+#endif
#define UCHCOM_INTR_STAT1 0x02
#define UCHCOM_INTR_STAT2 0x03
#define UCHCOM_INTR_LEAST 4
+/* magic number */
+#define UCHCOM_RESET_VALUE 0x501F
+#define UCHCOM_RESET_INDEX 0xD90A
+
#define UCHCOMIBUFSIZE 256
#define UCHCOMOBUFSIZE 256
@@ -715,6 +719,7 @@
static int
set_line_control(struct uchcom_softc *sc, tcflag_t cflag)
{
+#if 0
usbd_status err;
uint8_t lcr1val = 0, lcr2val = 0;
@@ -727,7 +732,7 @@
lcr1val &= ~UCHCOM_LCR1_MASK;
lcr2val &= ~UCHCOM_LCR2_MASK;
-
+#endif
/*
* XXX: it is difficult to handle the line control appropriately:
* - CS8, !CSTOPB and any parity mode seems ok, but
@@ -746,6 +751,9 @@
break;
}
+ if (ISSET(cflag, PARENB) || ISSET(cflag, CSTOPB))
+ return EINVAL;
+#if 0
if (ISSET(cflag, PARENB)) {
lcr1val |= UCHCOM_LCR1_PARENB;
if (ISSET(cflag, PARODD))
@@ -760,6 +768,7 @@
usbd_errstr(err));
return EIO;
}
+#endif
return 0;
}
@@ -784,6 +793,10 @@
reset_chip(struct uchcom_softc *sc)
{
usbd_status err;
+ err = generic_control_out(sc, UCHCOM_REQ_RESET,
+ UCHCOM_RESET_VALUE,
+ UCHCOM_RESET_INDEX);
+#if 0
uint8_t lcr1val, lcr2val, pre, div, mod;
uint16_t val=0, idx=0;
@@ -814,6 +827,7 @@
device_xname(sc->sc_dev), val, idx));
err = generic_control_out(sc, UCHCOM_REQ_RESET, val, idx);
+#endif
if (err)
goto failed;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment