ofi:vscode-ev3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ofi:vscode-ev3 [2022/06/24 18:21]
Ivo Blöchliger created
ofi:vscode-ev3 [2023/02/17 15:34] (current)
Ivo Blöchliger
Line 1: Line 1:
 ====== Native Python auf EV3 mit VSCode ====== ====== Native Python auf EV3 mit VSCode ======
   * https://education.lego.com/en-us/product-resources/mindstorms-ev3/teacher-resources/python-for-ev3   * https://education.lego.com/en-us/product-resources/mindstorms-ev3/teacher-resources/python-for-ev3
-  * SSH: user robot, pass maker+  * SSH: user robot, password maker
     * hostnamectl set-hostname LEGO12     * hostnamectl set-hostname LEGO12
 +    * WiFi-Daten in var/lib/connman
   * https://docs.pybricks.com/en/stable/   * https://docs.pybricks.com/en/stable/
 +  * Use ''dd'' with the ''conv=sparse'' option. It will seek instead of write. Exactly what we need ;-)
 + 
 +/etc/wpa_supplicant/wpa_supplicant.conf
 +<code txt wpa_suplicant>
 +#ctrl_interface=/var/run/wpa_supplicant
 +#ctrl_interface_group=benutzergruppe
 +# Die Gruppe muss natürlich angepasst werden
 +eapol_version=1
 +# 0: Der Treiber des Interfaces kümmert sich um das Scannen von Netzen und die AP-Auswahl.
 +#    Dieser Modus sollte benutzt werden, wenn man eine Verschlüsselung auf ein Kabelnetzwerk legt.
 +# 1: wpa_supplicant kümmert sich um das Scannen von Netzen und die AP-Auswahl.
 +# 2: Fast wie 0, es wird aber mit Hilfe von Sicherheitsrichtlinien und der SSID zu APs verbunden (BSSID wird nicht unterstützt)
 +#
 +# Normalerweise funktioniert entweder Modus 1 oder Modus 2.
 +ap_scan=1
 +
 +network={
 +        ssid="tech-lab"
 +        scan_ssid=1
 +        psk="tech-lab"
 +}
 +
 +</code>
 +
 +Way better than stuff below (also, you could take the image and then zero is out while mounted as loopback, much quicker!)
 +<code ruby>
 +def cmd(c)
 +  puts c
 +  r = `#{c}`
 +  return r
 +end
 +
 +raise "Provide hostname (like LEGO01)" unless $ARGV[0]
 +hostname = $ARGV[0]
 +
 +img = "lego01.img"
 +cmd("losetup -Pf #{img}")
 +dev = cmd("losetup -j #{img}").split(":")[0]
 +
 +p2 = dev+"p2"
 +cmd("mkdir -p p2")
 +cmd("mount #{p2} p2")
 +puts "Writing hostname #{hostname} to image"
 +cmd("echo #{hostname} > p2/etc/hostname")
 +cmd("umount p2")
 +
 +cmd("losetup -d ${dev}")
 +puts "Image is ready. Write it with"
 +puts "dd if=#{img} of=/dev/sdXXXX status=progress bs=1M conv=sparse"
 +
 +</code>
 +
 +
 +<code bash>
 +# Get Info
 +sudo fdisk -lu lego12.img 
 +Disk lego12.img: 14.84 GiB, 15931539456 bytes, 31116288 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: 0xf5e5f871
 +
 +Device      Boot  Start      End  Sectors  Size Id Type
 +lego12.img1        8192   106495    98304   48M  b W95 FAT32
 +lego12.img2      106496 31116287 31009792 14.8G 83 Linux
 +
 +
 +
 +# Mount Partition, -o Start*512, --sizelimit Sectors*512
 +sudo losetup -o 54525952 -b 512 --sizelimit 15877013504 /dev/loop16 lego12.img
 +
 +# Check filesystem
 +sudo e2fsck -f /dev/loop16
 +
 +# Resize filesystem
 +sudo resize2fs /dev/loop16 3750000
 +
 +# Mount filesystem
 +mount /dev/loop16 /mnt
 +
 +# Zero out disk
 +dd if=/dev/zero of=zero.txt bs=1M status=progress
 +
 +# Truncate image (size obtained from target SD-Card with fdisk -lu /dev/sda)
 +truncate -s 15634268160 lego12.img
 +</code>
  • ofi/vscode-ev3.1656087717.txt.gz
  • Last modified: 2022/06/24 18:21
  • by Ivo Blöchliger