Samsung Galaxy SII (samsung-i9100)

=== Contributors ===
* ollieparanoid
* veggie
* timbz
=== Device Owners ===
=== What does not work yet ===
* Audio
* Bluetooth
* Modem
* MHL (Video-out)
* See "Hardware specifications" for ideas how to get them working.
=== Installation ===
Follow the Installation instructions.
 $ pmbootstrap flasher flash_rootfs
 $ pmbootstrap flasher flash_kernel
=== Usage ===
==== Wifi ====
- Create conf for wpa_supplicant
 $ wpa_passphrase "SSID" "password" > wifi
Note : If you are connecting to a hidden wireless network, make sure to add line "scan_ssid=1" after the ssid line in your generated conf file
- Connect to wifi AP
 $ sudo wpa_supplicant -i wlan0 -c wifi &
- Get ip address from dhcp server (in another terminal)
 $ sudo udhcpc -i wlan0
To set wifi connection to start automatically on boot, please refer here wifi
==== Modem ====
Using Ofono: Best way seems to get Samsung IPC modem support from the patchset https://lists.ofono.org/pipermail/ofono/2012-September/013766.html (but it was not accepted) and does not build https://github.com/tssk/pmbootstrap/commits/device-samsung-i9100_modem . I would appreciate help from someone that understands C.
Second idea was to build Andoird RIL + Samsung RIL and get ofono working with ofono-ril support - https://redmine.replicant.us/projects/replicant/wiki/Samsung-RIL .
==== GPS ====
https://univers-libre.net/posts/galaxy-s2-gps-on-replicant.html
https://redmine.replicant.us/projects/replicant/wiki/GSD4t
https://github.com/mnalis/gsd4t_parser
https://redmine.replicant.us/boards/21/topics/897
==== Setting the hardware clock ====
If you have already setup chrony and if your hardware clock doesn't have the time set you can set it with,
localhost:~# hwclock -w # Write the current system time to the hardware clock
==== Setting the display brightness ====
To adjust display brightness write a value between 0-255 to file given below,
localhost:~# echo 0 > /sys/class/backlight/panel/brightness #set the display to its lowest brightness
localhost:~# echo 255 > /sys/class/backlight/panel/brightness #set the display to maximum brightness
==== Reading Accelerometer sensor ====
Accelerometer sensor data can read from following file
localhost:~$ cat /sys/class/accelerometer/accelerometer/acc_file 
=== Hardware specifications ===
==== SoC ====
Samsung Exynos 4 Dual 45 nm (GT-I9100, SHW-M250S/K/L) source
==== CPU ====
1.2 GHz dual-core ARM Cortex-A9 (GT-I9100, GT-I9105, GT-I9100G, SHW-M250S/K/L) source
==== GPU ====
ARM Mali-400 MP4 (GT-I9100, SHW-M250S/K/L) source
==== WiFi / Bluetooth / FM radio ====
Broadcom BCM4330 (SWB-B42) Bluetooth 4.0 Dual Band WLAN FM source source
Driver? - https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
Firmware - https://android.googlesource.com/platform/hardware/broadcom/wlan/+/master/bcmdhd/firmware/bcm4330/
==== Memory ====
1 GB RAM 
==== Storage ====
16 GB or 32 GB flash memory 
==== Removable storage ====
microSD (up to 128 GB SDXC) 
==== Modem ====
* XMM6260 
* aka "X-GOLD 626", and it's also used in Nexus 7 
* it seems to be supported by the mainline kernel (big questionmark here) 
==== Audio ====
* Yamaha MC1N2
* The Android kernel exposes the alsa API.
* But when you play with the volume sliders in alsamixer, nothing happens
* /dev/snd/hwC0D0 implements hardware-specific controls (via ioctl) (check the link for a free software Android userspace driver)
* We could write a daemon, that watches the alsa sound levels, and unmutes channels (speaker, headphones etc.) via hwC0D0 as necessary. (This will only work with the downstream kernel, the sound is probably not implemented in the upstream kernel at all?)
* Maybe all this is overkill and the strategy from Audio works as well.
==== Light / proximity sensor ====
the CM3663 sensor is being use and there is no driver in mainline. A downstream driver is available here.
==== MHL ====
* Fairchild FSA3200UMX switch 
* Maxim MAX8997 PMIC 
* Silicon Image 9244 transmitter 
* Should be all supported to a certain extent in mainline 4.15 kernel (of course the device is still stuck to 3.0 for the time being)
==== Serial / UART ====
Pressing home key during early boot enables bootloader debug output. To get kernel logs through 619 kOhm micro-usb serial debugging cable it is required to set the environmental variable SWITCH_SEL to 3 in bootloader SBL shell. To enter SBL shell hold the RETURN key in minicom/picocom/your favorite UART program when starting the device, until you get the SBL> prompt. From there you can then change the CMDLINE and boot with:
 setenv SWITCH_SEL 3
 setenv CMDLINE loglevel=7 console=ttySAC2,115200
 saveenv
 boot
Setting SWITCH_SEL somehow enables serial output on the USB connector. 
It is not exactly clear yet where to find UART / serial on the device. For possible location see second image below (red rectangle). Nevertheless a good instruction on hardware teardown is available here. Follow this guide until step 5, than proceed with removing the black cover from the circuit board (see first image below).
File:Samsung galaxy s2 i9100 teardown.jpg|thumb|left|Remove black cover (it is only glued)
File:Samsung galaxy s2 i9100 uart location.jpg|thumb|UART possibly located in this field (red rectangle)
=== Photos ===
* Initramfs asking for the password via telnet
* Weston with various programs opened
* postmarketOS demo menu (XWayland)
* Firefox (XWayland)
* Weston-smoke demo
* Weston-smoke demo running on a d710
* xfce-ui running on i9100
=== See also ===
* : initial MR with mainline, has serial output instructions
* Galaxy S2 Replicant port status update
* Replicant wiki device page
* Replicant wiki installation page
* 
* netcat installation method