Cantact OBD

This special CAN BUS hardware (https://cantact.io/cantact/users-guide.html) is very nice in the sense that it lends itself to many possibilities, and this is why I am creating this separate post about it.

An alternative board is the https://canable.io/ board, but I will stick to the board I own for this post

The standard firmware for my Cantact is candlelight available at linklayer/candleLight_fw, And there is a firmware here (https://github.com/HubertD/candleLight), the official users manual page is here (https://cantact.io/) and here (https://github.com/linklayer/cantact-book)

Linklayer also provides some very nice tools such as (https://github.com/linklayer/cantact-app)

Now, with that out of the way, let us take a look at the board itself

microcontroller

etching reads…

stm32f
042CbTb
GH238 93
CHN 708

Which tells us that the microcontroller is an STM32, A great choice for such a device (See the wikipedia article linked)

On linux, can-utils is a great tool for this thing

I actually made a 3D model casing that fits the board perfectly, I will post it here when i find it

List of OBD-II and Automotive repair software

This is a list of software and hardware that are relevant to repairing and parts of cars and trucks

Terms and concepts

Obviously, all of this is missing many details that are mostly irrelevant to why you are reading this post, You are probably here to figure out what tools you will need, and that is what I will focus on.

  • PID: Parameter IDs: The test software sends IDs and expects error codes or information in return, Some IDs are mandated by the state, other IDs are specific to a manufacturer.
  • response (Ex: Error) codes: Just like the PIDs (The questions- sent by the testing instruments), some responses are mandatory standards and others are manufacturer or car specific.
  • J1979: A standard set of PID/Response codes of which many are mandatory for all vehicles mostly for emissions regulations purposes
  • J1962: A standard for the hardware connector plug you can see under your instrument panel (Under your dash, in the footwell), formally named The DLC (Data link connector), Starting 1996, the OBD-II (OBD2) connector with both its variants (OBDII-A for 12V and OBDII-B for 24V) should be available for all cars sold in the US. Although it is now universal, some cars in other parts of the world didn’t get them until a few years later.
  • ELM327 command protocol:
  • J2534: THE TOOL, A tool that supports the J2534 standard should be able to speak to the vehicle in all of the following protocols (ISO9141, ISO14230 (KWP2000), J1850, CAN (ISO11898), ISO15765, SAE J2610, and J1939 (2005+))
Continue reading “List of OBD-II and Automotive repair software”

My brand new Sandisk clip sport plus MP3 player

Well, MP3 players are a thing of the past I know that much, but i do appreciate the compact size and dedicated hardware so I got this one, it came with 32GB of storage, Here are my findings

1- You need to heat up and remove the glass before you remove the frame as the frame has 4 screws under the glass !

2- The storage is a simple 32GB SD card, i took it out, Used DD to copy it to a 128GB SD card, put it back in, then used the format function on the device itself and it works !

That’s it, you can expand this to 128GB (Probably more, but i can’t guarantee that), but again, the firmware of the device is on the SD card, so you need to duplicate it before you put the new card in.

Adding an internal network to KVM

A private network connects select virtual machines to other virtual machines on the same host, and to the host itself, I usually use it to use samba shares between all virtual machines without giving those virtual machines access to the internet.

To do this, you will need to add a vridge to the host computer without an actual network interface that the bridge connects to, you can also add DHCP if you don’t care to hard code the IP addresses, the virtual machine can then use this interface to talk to other virtual machines or the host itself, A virtual machine can have both this network interface and another that does have access to the internet if you so chose

Continue reading “Adding an internal network to KVM”

Sunshine and moonlight

VNC and RDP are great and all, and for so many purposes, they are the goto solution for remoting into a machine.

Now, another solution which is great (And much better if you have the bandwidth) is to broadcast your screen video and do all the work on the server rather than the client

The solution used to be nvidia’s game stream, which was abandoned by nvidia, the new solution based on nvidia would be the sunshine (Server) and moonlight client

The sunshine+moonlight duo work on almost every platform I need, Windows, Mac, Android, iOS, Even LG TVs running web OS… in short, it is a more universal solution. You can even create a virtual non existent monitor under linux and stream that to a different device !

So, let us start with the server (Sunshine)

Installing sunshine on debian is very easy as a .deb installation file is provided, sunshine is not yet in the debian repositories, but if i understand the license correctly, it can be some time in the future

Now, go to the sunshine website, and download the deb file., in my case, I visit this webpage, and download the sunshine-debian-bookworm-amd64.deb file

Now, from the command prompt, su (to run as root), then cd to the directory where your deb file resides, then “sudo apt install ./sunshine-debian-bookworm-amd64.deb”, We should now have the server running and waiting to be opened in the web browser, Now, on the command line , type “sunshine”

Point a web browser to https://localhost:47990/, ignore the problem with self signed certificates, and set your username and password

Now, your debian computer is running a sunshine server, go to any other machine where you want to install the client (moonlight) from here , and connect to your server by its IP address.

You are done !

GPU PCIe passthrough on KVM

Before you start

This may look like a long post at first, but in reality, it is but a few commands, the rest is output and small simple explanations, so don’t be discouraged by the length, it is really neither complicated nor lengthy.

Yet, you do need to check the hardware requirements before you get your hands dirty, you will find them in the “Minimum hardware requirements” section of this post

Continue reading “GPU PCIe passthrough on KVM”

Hard drive power draw at startup

The maximum power draw a PC with many hard drives happens at boot time, in my case, the PC is a n intel atom D525MW, which hardly draws any power

What this means is that I need an oversized power supply that only does its thing at startup, then becomes an inefficient power supply right after, why this is particularly important is because this computer runs on a UPS, and the number of minutes it can stay up is a very important number.

The solution is to enable PUIS (Power up in standby), what this does is allow the disks not to spin as soon as they get power, but instead, spin up upon reception of a command from the controller. so in effect, the disks are spun up sequentially (In turn).

Continue reading “Hard drive power draw at startup”

JavaScript – Tools for the trip

Tools you will probably be using in your JavaScript journey, I will keep this list updated as I go. Some obvious tools like NPM and Yarn will be added along with the other obvious stuff, but I will be adding them once I have something usefull to point out about them.

1- A web browser

Web browser: On the market today, relevant to JavaScript development, there are 3 browsers, 1.1- Firefox, 1.2- Safari (And browsers based on it’s WebKit such as some browsers based on it), and everything else that are really all based on 1.3- google chrome (Yes, including both brave and MS edge).

I personally use Firefox, and for development purposes, I use “Firefox Browser Developer Edition“, I would probably make sure i have chrome installed, at least for cross browser compatibility, WebKit/Safari, I have never found a need for it, but it is there is you want to grab it

VS Code

Microsoft s super popular IDE, a great tool, itself written in JavaScript (Electron), but not so useful for JavaScript without a few good extensions, so here are a few extensions that you might need for Javascript development

  • VS Code JavaScript (ES6) snippets by charalampos karypidis
    This extension provides shortcuts to insert code directly into your project
  • ESLint by MidcroSoft
    Integrates ESLint JavaScript into VS Code. ESLint itself is a command line tool you run against your code to analyze it for potential problems, now, it is a VS Code plugin !
  • DotENV by mikestead
    Do you use a lot of .env variables ? I already use this for Laravel development, but it is also good for JS development, this tool adds highlighting and more to environment

Mounting QCOW2 (KVM/QEMU) directly

First, the tools you need

apt-get install qemu-utils

Now, enable NBD

modprobe nbd max_part=8

Once that is enabled, connect the file as a block device

qemu-nbd --connect=/dev/nbd0 /hds/usb/virts/Windows/main.qcow2

Now, the block device should appear like any other, alongside the partitions inside !

fdisk -l

On my machine, this resulted in

Disk /dev/nbd0: 95 GiB, 102005473280 bytes, 199229440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc5324c42

Device      Boot     Start       End   Sectors  Size Id Type
/dev/nbd0p1 *         2048    104447    102400   50M  7 HPFS/NTFS/exFAT
/dev/nbd0p2         104448 198138958 198034511 94.4G  7 HPFS/NTFS/exFAT
/dev/nbd0p3      198139904 199225343   1085440  530M 27 Hidden NTFS WinRE

This disk was around 40GB, but fdisk will see the number corresponding to the largest allowed size, 100GB in this case ! let us mount the drive

mount /dev/nbd0p2 /hds/loop

Now, in this case in particular, like any other block device that held the windows operating system, more often than not, you will get the message saying

The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Falling back to read-only mount because the NTFS partition is in an
unsafe state. Please resume and shutdown Windows fully (no hibernation
or fast restarting.)
Could not mount read-write, trying read-only

The solution to that is simple, follow the following two steps to remedy the issue and then force mount the file by using remove_hiberfile

ntfsfix /dev/nbd0p2
mount -t ntfs-3g -o remove_hiberfile /dev/nbd0p2 /hds/loop

The result of NTFSFIX was

Mounting volume... The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
FAILED
Attempting to correct errors...
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/nbd0p2 was processed successfully.

And the following mount command worked as you would expect, silently