Skip to content

Instantly share code, notes, and snippets.

View sjorge's full-sized avatar

Jorge Schrauwen sjorge

View GitHub Profile

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,
@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
@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 / 1_grain.yaml
Last active July 9, 2019 07:37
salt.grains.smartos fixes
pkgin_repositories:
- https://pkgsrc.joyent.com/packages/SmartOS/2018Q1/tools/All
- http://pkg.blackdot.be/packages/2018Q1/tools/All
pkgsrcpath:
https://pkgsrc.joyent.com/packages/SmartOS/2018Q1/tools/All
pkgsrcversion:
2018Q1
#!/usr/bin/bash
## CONFIG
# Lookup USBKEY: disklist -r
AUTO_REBOOT=1
MIRROR=us-east.manta.joyent.com
USBKEY=c1t0d0
## INIT
CURRENT_REFERENCE=$(curl -s -k https://${MIRROR}/Joyent_Dev/public/builds/smartos/ | grep release | tail -n 1 | json name)
[16:05:04] <sjorge> There is a mistake in https://mgerdts.github.io/2018/03/14/omnios-bhyve-guest.html, the zfs clone command has omios instead of omnios
[16:05:49] <mgerdts> that's what I get for not logging my terminal when I may create a blog post. :)
[16:05:52] <mgerdts> thanks, will fix
[16:51:30] <sjorge> I got it all up and running now, I got a few more remarks
[16:51:33] <sjorge> bhyvectl --destroy --vm=o1
[16:51:41] <sjorge> Is needed to free o1
[16:51:45] <mgerdts> ah yes
[16:51:49] <sjorge> missing manifest.json example, perhaps link https://raw.githubusercontent.com/joyent/manifest-creator/master/create-kvm-manifest
[16:54:19] <sjorge> https://gist.github.com/sjorge/0dfd42584249e2827a38bfff4ceacf76 <- not sure this is by design or not
/*
* HD Set Parm
* ----------------------------
* Based on setapm and setaam from:
* http://solaris.kuehnke.de/archives/23-Set-APM-and-AAM-feature-configuration \
* -attributes-for-disks-on-Solaris.html
*/
#include <stdio.h>
#include <stdlib.h>
@sjorge
sjorge / zone-bootstrap.sh
Created March 10, 2017 07:19
SaltStack Boostrapper for SmartOS
#!/bin/bash
####
## Acheron SaltStack Bootstrap
## ---------------------------
####
### configuration
SALT_VERSION=2016.11
SALT_MASTER=salt-master.example.org
LOGFILE=/var/log/bootstrap.log
(rebus)[root@qdb ~/salt]# /opt/rebus/bin/salt-master --versions-report
Salt Version:
Salt: 2015.8.4-180-g625da0d
Dependency Versions:
Jinja2: 2.8
M2Crypto: Not Installed
Mako: Not Installed
PyYAML: 3.11
PyZMQ: 15.2.0
51366 execve("/sbin/start", ["start", "plexmediaserver"], [/* 13 vars */]) = 0
51366 brk(0) = 0x1000
51366 uname({sys="Linux", node="artemis", ...}) = 0
51366 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
51366 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fffff060000
51366 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
51366 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
51366 fstat(3, {st_mode=S_IFREG|0644, st_size=19783, ...}) = 0
51366 mmap(NULL, 19783, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fffff050000
51366 close(3) = 0