Skip to content

Instantly share code, notes, and snippets.

View sjorge's full-sized avatar

Jorge Schrauwen sjorge

View GitHub Profile
@sjorge
sjorge / 1_salt_grains_mdata.patch
Last active July 9, 2019 11:24
salt.grains.mdata
--- /opt/tools/lib/python2.7/site-packages/salt/grains/mdata.py Tue Jul 9 11:24:40 2019
+++ /opt/tools/lib/python2.7/site-packages/salt/grains/mdata.py.fix Tue Jul 9 11:24:07 2019
@@ -63,6 +63,8 @@
return grains
for mdata_grain in __salt__['cmd.run'](mdata_list, ignore_retcode=True).splitlines():
+ if mdata_grain.startswith("ERROR:"):
+ continue
mdata_value = __salt__['cmd.run']('{0} {1}'.format(mdata_get, mdata_grain), ignore_retcode=True)
@sjorge
sjorge / auto_home
Last active January 11, 2020 16:23
#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright 2019 Joyent, Inc.
# Inspired by
# http://znogger.blogspot.com/2010/05/solaris-automatic-creation-of-home-dirs.html

Currently I am stuck trying to retrieve the version of the chip, which seems to be needed to configure it slightly different later on. FreeBSD function https://github.com/freebsd/freebsd/blob/f6abce8e79ecc1992d2d0b2e53f8e92ab3102671/sys/dev/usb/serial/uchcom.c#L479, which calls a different function to read data into a buffer from the device.

A similar function is also present for writing, based on ftdi and pl2303 I managed to get the write function to work (I think, it returns USB_SUCCESS). However I cannot get the read function to work, It returns USB_FAILURE with CR set to Endpoint returned stall PID

static int
uchcom_cmd_vendor_write0(uchcom_state_t *uch,