Hacks, hints, and tricks

From Studio Kousagi Wiki
Revision as of 16:26, 26 December 2015 by Bunnie (talk | contribs) (Enabling eepromoops)
Jump to: navigation, search

A resting place for important technotes that don't fit anywhere else.

Hacks

I2C debugging

The kernel will lock I2C devices, making it impossible to use userspace tools to debug an issue. To get around this, modify drivers/i2c/i2c-dev.c and remove the EBUSY return statement. E.g. there's a function that either returns 0 or -EBUSY, make it always return 0.

Then you can use the i2c utilities to access devices that are in use.

Linux kernel debugfs

/sys/kernel/debug

contains helpful debugging infos. To mount this, use this command (assuming you've compiled in said support):

mount -tdebugfs none /sys/kernel/debug

Hints

Building a u-boot script

mkimage -T script -C none -n 'Novena Boot Script' -d boot.txt boot.scr

boot.txt is the non-binary gook extractable from boot.scr, or you can look at the git repo to retrieve it.

Using a serial port

To use a plug-in USB serial port with screen, you need to be part of the "dialup" group.

sudo adduser <username> dialup 

Exit, and log back in. You should be able to do something like

screen /dev/ttyUSB0 115200

and use the USB serial adapter you just plugged in.

Bluetooth pairing (deprecated)

Some keyboards don't have a fixed PIN. To pair with them, edit the bluez-simple-agent program:

sudo emacs /usr/bin/bluez-simple-agent

and replace ‘KeyboardDisplay’ with ‘DisplayYesNo’.

This will cause the agent to display the PIN code you have to enter, instead of assuming it's fixed at 0000.

Then you can run

hcitool scan

Pick out the MAC of the device, and run

bluez-simple-agent hci0 [your mac address]

This should pair the two, to unpair you can do

bluez-simple-agent hci0 [your mac address] remove

Now you have to "trust" the device:

bluez-test-device trusted [your mac address] yes

And finally, connect it:

bluez-test-input connect [your mac address] yes

Bluetooth Pairing (use this one)

Remove any old bluetooth configuration directories:

sudo rm /var/lib/bluetooth

This is particularly important if you're switching to a new bluetooth host. For some reason re-pairing a device will not work until this directory is deleted.

Run bluetoothctl:

sudo bluetoothctl -a

You may have to power on the host controller using the "power on" command.

Find the device to pair with. It should be listed. Otherwise, start a scan.

Pair the device. Note that tab-completion works, and makes things helpful.

pair [your mac address]

The console will give you the PIN code of the keyboard. Type this on the keyboard and hit Enter.

Trust the keyboard:

trust [your mac address]

Getting date and time to work

The system should get date/time automatically when you get an IP address.

If that's not happening, do the following:

sudo rm /etc/udev/rules.d/70-persistent-net.rules

This will remove anything that's interfering with getting the DHCP client to work.

Also make sure that this package exists

sudo apt-get install ntpdate

Novena USB hub

See Novena-usb-hub

Startup scripts and systemd

See https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/Linux_Startup_Process_-_Systemd for help.

exagear and skype

Grab the debian version of x86 skype and install under exagear. dpkg will fail but use sudo apt-get install -f to fix the dependecnies. This will subsequently break dbus on the host machine. Fix this using the following command line:

sudo systemctl disable exagear-guest-debian-7

Enabling eepromoops

EEPROM has to be added to the device tree in order to enable eepromoops.

Here's the entry:

&i2c3 {
   eepromoops@56 {
       compatible = "kosagi,eepromoops";
       reg = <0x56>;
  };
};