Patched FTDIUSBSerialDriver kext has to be unloaded/reloaded after reboot (OSX 10.10). Any ideas? - osx-yosemite

I'm exchanging data between a bare-bone Arduino and openFrameworks via a serial UART FTDI connection. I'm using a patched FTDI driver to achieve higher BAUD rates on OSX. FTDIChip calls it "Aliasing VCP Baud Rates".
See:
http://spin.atomicobject.com/2013/06/23/baud-rates-ftdi-driver-mac/
https://github.com/arminbw/wiretouch/blob/v0.21/perl/modify-ftdi-driver-settings.pl
This worked until recently. Since upgrading to OSX 10.10 I have to manually unload and reload the kext to make it work:
sudo kextload -b com.FTDI.driver.FTDIUSBSerialDriver
sudo kextunload -b com.FTDI.driver.FTDIUSBSerialDriver
kextstat tells me that the kext is loaded. It just doesn't function correctly until I reload it. Has anyone had similar issues with kext-loading? Has anyone any idea what the problem could be?
Thanks!
Armin

It would depend on the specifics of the kext in question, but generally speaking, it probably depends on a subsystem that isn't up yet by the time it gets matched to the hardware. For example, the BSD subsystem might be required to present the device file for the serial port, but the kext gets loaded before then; if that's the case, you can instruct the system to only create an instance of your driver once BSD is up using a IOResourceMatch property of IOBSD in your personality's dictionary in the Info.plist. (don't forget to re-codesign the kext after modifying the Info.plist)

Related

How would I use Arduino-CLI in WSL?

I recently started playing with an ESP8266 and wanted to try uploading to it using WSL. I found the Arduino-CLI command and followed some tutorials but couldn't figure out how to upload to the board. The command I tried running is arduino-cli upload -p /dev/ttyS5 --fqbn esp8266:esp8266:arduino-esp8266 Testing because I know that the board is an ESP8266 and the is connected to COM5 on the Windows Arduino app. The code compiles and attempts to connect to the board, but cannot get past that part.
This is the code I was trying to upload.
void setup() {
pinMode(0, OUTPUT);
}
void loop() {
digitalWrite(0, HIGH);
delay(1000);
digitalWrite(0, LOW);
delay(1000);
}
When I execute arduino-cli board list, it shows this.
Port Protocol Type Board Name FQBN Core
serial Unknown
I'm using Windows Terminal for Ubuntu 20.04 and just installed Arduino-CLI.
I also am not sure how to ask stuff cuz it's my first time using StackOverflow, so pls tell me if I'm doing something wrong :)
Edit: So it turns out that I was uploading using the wrong core. I ended up trying every single core listed by arduino-cli board listall esp8266 and it eventually worked with esp8266:esp8266:nodemcuv2 instead of esp8266:esp8266:arduino-esp8266.
Just educated guesses here from my understanding of WSL rather than Arduino.
I'm assuming that you are using WSL2, which doesn't have access to most Windows hardware, including the serial ports.
If that's the case, two options that you might try:
WSL1 does have some better direct hardware access, at the expense of some kernel compatibility (since it attempts to translate syscalls rather than virtualize them). You can try converting the distribution to WSL1 via:
wsl -l -v
# Confirm distribution name
wsl --set-version <distro_name> 1
You might want to back it up first with wsl --export <distro_name> backup.tar.
As mentioned in the comments, you should be able to use the Windows toolchain. You can even run this under WSL2, since Windows commands can be executed there through interop (and would have hardware access). Remember to use the full executable, like /mnt/c/arduino-cli/arduino-cli.exe. And also you'll need to convert any Linux/WSL paths to their Windows equivalent with wslpath.

Running a program written for freeRTOS (RTOS) in virtualmachine as a binary

I got a simple program written for freeRTOS (implements a timer).
I want to run this program in an empty virtual machine (VirtualBox, or QEMU, or something else).
I need to make a binary file that can run in and empty VM.
Any advice or direction of how can i do this?
I checked many stuff on freeRTOS homepage but couldn't find something useful.
For virtual box, you will need a binary of freeRTOS that is x86 or amd64 compatible. Check if this is of any benefit for you.
You can check this link, as I understand it's a simulator for freeRTOS which may enable you to test it without a virtual machine.
For QEMU, check this link
Emm..., if you need run just binary file without any OS started you can use qemu for that. Just pass your binary through option '-bios' into qemu. And after qemu will start it to run. Also use '-S -s' options in for enabling gdb server in qemu. After you can connect to qemu with gdb client and debug you binary step by step.

OpenCl: Minimal configuration to work with AMD GPU

Suppose we have AMD GPU (for example Radeon HD 7970) and minimal linux system without X and etc.
What should be installed and what should be launched and how it should be launched to have proper OpenCL environment? In best case it should be headless environment.
Requirements to environment:
GPU visible by OpenCL programs (clinfo for example)
It is possible to monitor temperature and set fan speed (for example using aticonfig).
P.S. Simple install Xserver, catalyst and run X :0 won't work properly. See X server with fglrx driver won't responce after exactly 49 accesses to X server
UPD When you use AMD GPU on linux, OpenCL applications don't see AMD GPU if Xserver isn't launched.
I had similar problem, asked a question and had succeed solving it by myself.
For R9 290 cards and newer i assume you have:
Built kernel 4.14 or later, with amdgpu driver support. There is option in linux kernel config under Graphics Support.
All nesesary firmware .bin blobs are incorporated. To do so easily you may edit buildroot/package/linux-firmware/* contents for buildroot, and manually add BR2_PACKAGE_LINUX_FIRMWARE_AMDGPU option by yourself, along with BR2_PACKAGE_LINUX_FIRMWARE_RADEON (use it as a template). Actually we should post that update to their git.
When booting you should see appropriate dmesg messages about amdgpu initializing, per each adapter. And screen mode should be switched. If you still see large console text and no videomode switch occured during init then you have problem in kernel/firmware, you should fix that out first.
To answer second question, controlling fan speeds/temperatures is achieved via powerplay filesystem, eg /sys/class/drm/.. like this:
cd sys/class/drm/card0/device/hwmon/hwmon0
echo 1 > pwm1_enable
cat pwm1_max > pwm1
You may dig a bit deeper and find powertune parameters nearby, in device folder.
But instead of using /sys/class/drm/card0/device/pp_dpm_sclk i highly recommend flashing that values directly in cards' bios. Set with required frequencies/voltages, as it is more reliable, stable and api independent - you either init it, or not :)
PS. Also put away 7970, buy something a bit newer. I dont know if it is still supported in the latest drivers, we havent such an old card by hands right now. I tested 290, 390, 480, 580 cards series. (for R9 270, miner fails to build cl code). For older cards better to use some older software <=16.40 and maybe a bit older kernel <=4.13

Raspberry Pi shutdown destroys file system

I trying to write a small c program witch reads out an GPIO pin to shutdown the pi externally. The triggering of the signal is working well. The program is started by LXDE as autostart application. If the program detects the shutdown signal it's performing:
sync();
system("halt");
Why does this program damage my ext4 file system after a couple of reboots. There is no fixed number of reboots necessary to damage the system. I don't see any difference by writing halt to command line. I'm using the newest version of the firmware(last update today) and also the kernel is up to date(last update today).
Does anybody have an good idea about it?
This app is a good idea, i wonder nothing like this is already existing...
I think the problem is the "halt" command.
You shuold use the explicit command "shutdown -h now" instead.
For further reading see Anthony Lawrence

avrdude xmega256a3 can't program usersig?

I use avrdude on osx to do development for an xmega256a3. It's wonderful, it lets me flash my target just fine. However, when I try to use it to program the usersig block, it doesn't work so well. I was initially excited by some early success with it, but found subsequent flashes weren't working.
Through testing, I determined that if my usersig file was for all 0's, it worked fine. But all FF's didn't work. Given what little I know about flash, these leads me to believe that I'm either missing an option or avrdude isn't doing a complete job for what it needs to do here.
The command I'm using is
avrdude -p atxmega256a3 -P usb -c avrispmkii -e -U usersig:w:mySig.hex
Using AVR Studio 4 on a Windows box, I am able to program any of these files to the usersig flash block.
My question boils down to is this possible? if so what option/incantation am I missing? Or am I out of luck for programming usersig for this processor with avrdude?
(I'm using version 5.11.1 from the CrossPack guys)
It turns out that old versions of avrdude indeed did not support this. It requires a page erase of usersig, and that was not supported until version 6, which is due out soon. I've tested with svn builds of it, and with a two line patch submitted to day, it does the job.