ARM V7 linux kernel 4.1.12 Boot up logs

root@beaglebone:~# dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.1.12-ti-r29 (root@a5-imx6q-wandboard-2gb) (gcc version 4.9.2 (Debian 4.9.2-10) ) #1 SMP PREEMPT Mon Nov 9 22:46:19 UTC 2015
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: TI AM335x BeagleBone Black
[    0.000000] cma: Reserved 24 MiB at 0x9e000000
[    0.000000] Memory policy: Data cache writeback
[    0.000000] On node 0 totalpages: 130560
[    0.000000] free_area_init_node: node 0, pgdat c0f95d00, node_mem_map df96d000
[    0.000000]   Normal zone: 1152 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 130560 pages, LIFO batch:31
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES2.0 (sgx neon )
[    0.000000] PERCPU: Embedded 13 pages/cpu @df925000 s22336 r8192 d22720 u53248
[    0.000000] pcpu-alloc: s22336 r8192 d22720 u53248 alloc=13*4096
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 129408
[    0.000000] Kernel command line: console=tty0 console=ttyO0,115200n8 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait coherent_pool=1M quiet cape_universal=enable
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 471372K/522240K available (10729K kernel code, 929K rwdata, 3712K rodata, 684K init, 902K bss, 26292K reserved, 24576K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xe0800000 - 0xff000000   ( 488 MB)
    lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc0e226e0   (14442 kB)
      .init : 0xc0e23000 - 0xc0ece000   ( 684 kB)
      .data : 0xc0ece000 - 0xc0fb664c   ( 930 kB)
       .bss : 0xc0fb9000 - 0xc109a8d8   ( 903 kB)
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] RCU dyntick-idle grace-period acceleration is enabled.
[    0.000000] RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
[    0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[    0.000022] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000058] clocksource timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000082] OMAP clocksource: timer1 at 24000000 Hz
[    0.000655] Console: colour dummy device 80x30
[    0.000919] console [tty0] enabled
[    0.000956] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
[    0.000972] This ensures that you still see kernel messages. Please
[    0.000987] update your kernel commandline.
[    0.001022] Calibrating delay loop... 545.99 BogoMIPS (lpj=2729984)
[    0.057846] pid_max: default: 32768 minimum: 301
[    0.058123] Security Framework initialized
[    0.058232] AppArmor: AppArmor disabled by boot time parameter
[    0.058252] Yama: becoming mindful.
[    0.058618] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.058646] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.060100] Initializing cgroup subsys blkio
[    0.060146] Initializing cgroup subsys memory
[    0.060222] Initializing cgroup subsys devices
[    0.060256] Initializing cgroup subsys freezer
[    0.060302] Initializing cgroup subsys net_cls
[    0.060333] Initializing cgroup subsys perf_event
[    0.060365] Initializing cgroup subsys net_prio
[    0.060461] CPU: Testing write buffer coherency: ok
[    0.060558] ftrace: allocating 34832 entries in 103 pages
[    0.226768] CPU0: thread -1, cpu 0, socket -1, mpidr 0
[    0.226941] Setting up static identity map for 0x80008280 - 0x800082d8
[    0.277973] Brought up 1 CPUs
[    0.278013] SMP: Total of 1 processors activated (545.99 BogoMIPS).
[    0.278030] CPU: All CPU(s) started in SVC mode.
[    0.279349] devtmpfs: initialized
[    0.312133] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    0.351729] omap_hwmod: tptc0 using broken dt data from edma
[    0.352160] omap_hwmod: tptc1 using broken dt data from edma
[    0.352569] omap_hwmod: tptc2 using broken dt data from edma
[    0.361216] omap_hwmod: debugss: _wait_target_disable failed
[    0.420477] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.423510] xor: measuring software checksum speed
[    0.517992]    arm4regs  :   670.400 MB/sec
[    0.617901]    8regs     :   600.400 MB/sec
[    0.717895]    32regs    :   599.200 MB/sec
[    0.817898]    neon      :   917.600 MB/sec
[    0.817916] xor: using function: neon (917.600 MB/sec)
[    0.818158] pinctrl core: initialized pinctrl subsystem
[    0.821302] NET: Registered protocol family 16
[    0.827412] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[    0.838463] OMAP GPIO hardware version 0.1
[    0.863307] No ATAGs?
[    0.863358] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.866611] omap4_sram_init:Unable to allocate sram needed to handle errata I688
[    0.866642] omap4_sram_init:Unable to get sram pool needed to handle errata I688
[    1.078119] raid6: int32x1  gen()   126 MB/s
[    1.247943] raid6: int32x1  xor()    96 MB/s
[    1.418125] raid6: int32x2  gen()   167 MB/s
[    1.588055] raid6: int32x2  xor()   109 MB/s
[    1.758139] raid6: int32x4  gen()   156 MB/s
[    1.928013] raid6: int32x4  xor()   109 MB/s
[    2.097927] raid6: int32x8  gen()   155 MB/s
[    2.267993] raid6: int32x8  xor()   102 MB/s
[    2.437948] raid6: neonx1   gen()   804 MB/s
[    2.607938] raid6: neonx2   gen()  1039 MB/s
[    2.777944] raid6: neonx4   gen()  1057 MB/s
[    2.947941] raid6: neonx8   gen()   446 MB/s
[    2.947958] raid6: using algorithm neonx4 gen() 1057 MB/s
[    2.947974] raid6: using intx1 recovery algorithm
[    2.964935] edma-dma-engine edma-dma-engine.0: TI EDMA DMA engine driver
[    2.971030] vgaarb: loaded
[    2.972281] SCSI subsystem initialized
[    2.972841] libata version 3.00 loaded.
[    2.973444] usbcore: registered new interface driver usbfs
[    2.973601] usbcore: registered new interface driver hub
[    2.973792] usbcore: registered new device driver usb
[    2.974863] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
[    2.974957] omap_i2c 4819c000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c2_pins, deferring probe
[    2.975226] pps_core: LinuxPPS API ver. 1 registered
[    2.975244] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    2.975303] PTP clock support registered
[    2.977037] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
[    2.978134] Advanced Linux Sound Architecture Driver Initialized.
[    2.979545] NetLabel: Initializing
[    2.979567] NetLabel:  domain hash size = 128
[    2.979580] NetLabel:  protocols = UNLABELED CIPSOv4
[    2.979691] NetLabel:  unlabeled traffic allowed by default
[    2.980288] Switched to clocksource timer1
[    3.192641] NET: Registered protocol family 2
[    3.194112] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    3.194202] TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
[    3.194311] TCP: Hash tables configured (established 4096 bind 4096)
[    3.194436] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    3.194478] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    3.194964] NET: Registered protocol family 1
[    3.195839] RPC: Registered named UNIX socket transport module.
[    3.195862] RPC: Registered udp transport module.
[    3.195877] RPC: Registered tcp transport module.
[    3.195891] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    3.195936] PCI: CLS 0 bytes, default 64
[    3.196876] Unpacking initramfs...
[    3.680629] Freeing initrd memory: 3876K (c8080000 - c8449000)
[    3.681350] CPU PMU: Failed to parse /pmu/interrupt-affinity[0]
[    3.681453] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[    3.686161] futex hash table entries: 256 (order: 2, 16384 bytes)
[    3.686345] audit: initializing netlink subsys (disabled)
[    3.686498] audit: type=2000 audit(3.580:1): initialized
[    3.688881] zpool: loaded
[    3.688915] zbud: loaded
[    3.689523] VFS: Disk quotas dquot_6.6.0
[    3.689659] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    3.691145] NFS: Registering the id_resolver key type
[    3.691258] Key type id_resolver registered
[    3.691275] Key type id_legacy registered
[    3.691319] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    3.691883] fuse init (API version 7.23)
[    3.692335] SGI XFS with ACLs, security attributes, realtime, no debug enabled
[    3.697817] NET: Registered protocol family 38
[    3.698038] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    3.698418] io scheduler noop registered
[    3.698451] io scheduler deadline registered
[    3.698515] io scheduler cfq registered (default)
[    3.701478] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
[    3.705917] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
[    3.708290] Serial: 8250/16550 driver, 6 ports, IRQ sharing disabled
[    3.714209] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 155, base_baud = 3000000) is a 8250
[    3.722365] console [ttyS0] enabled
[    3.724844] [drm] Initialized drm 1.1.0 20060810
[    3.725040] usbcore: registered new interface driver udl
[    3.800292] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
[    3.800329] davinci_mdio 4a101000.mdio: detected phy mask fffffffe
[    3.800798] davinci_mdio: dt: updated phy_id[0] from phy_mask[fffffffe]
[    3.812397] libphy: 4a101000.mdio: probed
[    3.812449] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
[    3.813778] cpsw 4a100000.ethernet: Detected MACID = c8:a0:30:c5:44:90
[    3.815725] pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver
[    3.815907] usbcore: registered new interface driver pegasus
[    3.816025] usbcore: registered new interface driver rtl8150
[    3.816137] usbcore: registered new interface driver r8152
[    3.818749] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    3.818816] ehci-pci: EHCI PCI platform driver
[    3.818945] ehci-platform: EHCI generic platform driver
[    3.819290] ehci-omap: OMAP-EHCI Host Controller driver
[    3.822527] 47401300.usb-phy supply vcc not found, using dummy regulator
[    3.853334] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
[    3.853367] musb-hdrc: MHDRC RTL version 2.0
[    3.853384] musb-hdrc: setup fifo_mode 4
[    3.853419] musb-hdrc: 28/31 max ep, 16384/16384 memory
[    3.855719] 47401b00.usb-phy supply vcc not found, using dummy regulator
[    3.883209] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
[    3.883241] musb-hdrc: MHDRC RTL version 2.0
[    3.883258] musb-hdrc: setup fifo_mode 4
[    3.883289] musb-hdrc: 28/31 max ep, 16384/16384 memory
[    3.883551] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    3.884135] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[    3.884582] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    3.884606] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.884626] usb usb1: Product: MUSB HDRC host driver
[    3.884645] usb usb1: Manufacturer: Linux 4.1.12-ti-r29 musb-hcd
[    3.884663] usb usb1: SerialNumber: musb-hdrc.1.auto
[    3.886135] hub 1-0:1.0: USB hub found
[    3.886249] hub 1-0:1.0: 1 port detected
[    4.019131] mousedev: PS/2 mouse device common for all mice
[    4.021541] omap_rtc 44e3e000.rtc: rtc core: registered 44e3e000.rtc as rtc0
[    4.022997] i2c /dev entries driver
[    4.025538] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[    4.027218] omap_hsmmc 48060000.mmc: Got CD GPIO
[    4.117755] mmc0: host does not support reading read-only switch, assuming write-enable
[    4.119847] mmc0: new high speed SDHC card at address 59b4
[    4.122860] ledtrig-cpu: registered to indicate activity on CPUs
[    4.123430] omap-aes 53500000.aes: OMAP AES hw accel rev: 3.2
[    4.124955] mmcblk0: mmc0:59b4 SDU1  7.46 GiB
[    4.127169]  mmcblk0: p1 p2
[    4.131419] omap-sham 53100000.sham: hw accel on OMAP rev 4.3
[    4.131472] omap-sham 53100000.sham: initialization failed.
[    4.137195] omap-sham: probe of 53100000.sham failed with error -22
[    4.137585] hidraw: raw HID events driver (C) Jiri Kosina
[    4.143719] usbcore: registered new interface driver usbhid
[    4.143833] usbhid: USB HID core driver
[    4.144398] ashmem: initialized
[    4.149162]  remoteproc0: wkup_m3 is available
[    4.149189]  remoteproc0: Note: remoteproc is still under development and considered experimental.
[    4.149206]  remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
[    4.155138] oprofile: using arm/armv7
[    4.155812] NET: Registered protocol family 10
[    4.157893] mip6: Mobile IPv6
[    4.157950] NET: Registered protocol family 17
[    4.158163] Key type dns_resolver registered
[    4.158189] mpls_gso: MPLS GSO support
[    4.158639] omap_voltage_late_init: Voltage driver support not added
[    4.159396] cpu cpu0: of_pm_voltdm_notifier_register: Failed to get cpu0 regulator/voltdm: -517
[    4.159428] cpu cpu0: cpu0 clock notifier not ready, retry
[    4.166588] PM: bootloader does not support rtc-only!
[    4.166760] ThumbEE CPU extension supported.
[    4.166815] Registering SWP/SWPB emulation handler
[    4.168841] registered taskstats version 1
[    4.170801] Btrfs loaded
[    4.179004] mmc1: MAN_BKOPS_EN bit is not set
[    4.181444] mmc1: new high speed MMC card at address 0001
[    4.189875] mmcblk1: mmc1:0001 MMC02G 1.78 GiB
[    4.190708] mmcblk1boot0: mmc1:0001 MMC02G partition 1 1.00 MiB
[    4.191393] mmcblk1boot1: mmc1:0001 MMC02G partition 2 1.00 MiB
[    4.194093]  mmcblk1: p1 p2
[    4.215340] Key type encrypted registered
[    4.220115] input: tps65217_pwr_but as /devices/platform/ocp/44e0b000.i2c/i2c-0/0-0024/input/input0
[    4.254635] tps65217 0-0024: TPS65217 ID 0xe version 1.2
[    4.255606] at24 0-0050: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
[    4.256059] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[    4.258983] at24 2-0054: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
[    4.259765] at24 2-0055: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
[    4.260699] at24 2-0056: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
[    4.261445] at24 2-0057: 32768 byte 24c256 EEPROM, writable, 1 bytes/write
[    4.261528] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
[    4.263504]  remoteproc0: powering up wkup_m3
[    4.263544]  remoteproc0: Booting fw image am335x-pm-firmware.elf, size 219735
[    4.263852]  remoteproc0: remote processor wkup_m3 is now up
[    4.263882] wkup_m3_ipc 44e11324.wkup_m3_ipc: CM3 Firmware Version = 0x191
[    4.269611] bone_capemgr bone_capemgr: Baseboard: 'A335BNLT,0A5C,3213BBBK2621'
[    4.269663] bone_capemgr bone_capemgr: compatible-baseboard=ti,beaglebone-black - #slots=4
[    4.320314] bone_capemgr bone_capemgr: slot #0: No cape found
[    4.380276] bone_capemgr bone_capemgr: slot #1: No cape found
[    4.440263] bone_capemgr bone_capemgr: slot #2: No cape found
[    4.500280] bone_capemgr bone_capemgr: slot #3: No cape found
[    4.506248] bone_capemgr bone_capemgr: initialized OK.
[    4.507128] cpu cpu0: of_pm_voltdm_notifier_register: Fail calculating voltage latency[950000<->1325000]:-22
[    4.507839] cpu cpu0: of_pm_voltdm_notifier_register: Fail calculating voltage latency[950000<->1325000]:-22
[    4.508032] cpufreq: __cpufreq_add_dev: CPU0: Running at unlisted freq: 550000 KHz
[    4.510460] cpufreq: __cpufreq_add_dev: CPU0: Unlisted initial frequency changed to: 600000 KHz
[    4.513102] omap_rtc 44e3e000.rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
[    4.513132] of_cfs_init
[    4.513275] of_cfs_init: OK
[    4.519647] PM: Hibernation image not present or could not be loaded.
[    4.519821] ALSA device list:
[    4.519831]   No soundcards found.
[    4.521324] Freeing unused kernel memory: 684K (c0e23000 - c0ece000)
[    4.584021] systemd-udevd[101]: starting version 215
[    4.586722] random: systemd-udevd urandom read with 11 bits of entropy available
[   10.570567] EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem
[   10.570595] EXT4-fs (mmcblk0p2): write access will be enabled during recovery
[   11.498033] EXT4-fs (mmcblk0p2): recovery complete
[   11.577446] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[   12.254768] systemd[1]: Configuration file /lib/systemd/system/bonescript.socket is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
[   12.256597] systemd[1]: Configuration file /lib/systemd/system/bonescript.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
[   12.298703] systemd[1]: Configuration file /etc/systemd/system/serial-getty@ttyGS0.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
[   12.309976] systemd[1]: Configuration file /lib/systemd/system/jekyll-autorun.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
[   12.313371] systemd[1]: Configuration file /lib/systemd/system/capemgr.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
[   12.315002] systemd[1]: Configuration file /lib/systemd/system/bonescript-autorun.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
[   12.344607] systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.
[   12.966506] EXT4-fs (mmcblk0p2): re-mounted. Opts: errors=remount-ro
[   13.269909] systemd-udevd[184]: starting version 215
[   15.670165] random: nonblocking pool is initialized
[   16.530668] net eth0: initializing cpsw version 1.12 (0)
[   16.533086] net eth0: phy found : id is : 0x7c0f1
[   16.572909] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   16.905451] using random self ethernet address
[   16.905482] using random host ethernet address
[   16.905509] using self ethernet address: C8:A0:30:C5:44:91
[   16.993140] Mass Storage Function, version: 2009/09/11
[   16.993172] LUN: removable file: (no medium)
[   16.993598] LUN: removable file: /dev/mmcblk0p1
[   16.993613] Number of LUNs=1
[   17.003650] usb0: HOST MAC 82:e5:78:66:69:0a
[   17.003926] usb0: MAC c8:a0:30:c5:44:91
[   17.003993] Number of LUNs=1
[   17.018536] g_multi gadget: Multifunction Composite Gadget
[   17.018574] g_multi gadget: g_multi ready
[   17.740784] systemd-journald[178]: Received request to flush runtime journal from PID 1
[   18.532345] tda998x 0-0070: Falling back to first CRTC
[   18.706960] tda998x 0-0070: found TDA19988
[   18.713791] tilcdc 4830e000.lcdc: bound 0-0070 (ops tda998x_ops [tda998x])
[   18.713828] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[   18.713838] [drm] No driver support for vblank timestamp query.
[   18.718251] tilcdc 4830e000.lcdc: No connectors reported connected with modes
[   18.718296] [drm] Cannot find any crtc or sizes - going 1024x768
[   18.979551] Console: switching to colour frame buffer device 128x48
[   19.422568] tilcdc 4830e000.lcdc: fb0:  frame buffer device
[   19.422595] tilcdc 4830e000.lcdc: registered panic notifier
[   19.499909] [drm] Initialized tilcdc 1.0.0 20121205 on minor 0
[   19.501977] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
[   19.611076] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[   19.611300] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   19.733190] 8021q: 802.1Q VLAN Support v1.8
[   19.733312] 8021q: adding VLAN 0 to HW filter on device eth0
[   20.145979] pruss-rproc 4a300000.pruss: 8 PRU interrupts parsed
[   20.146091] pruss-rproc 4a300000.pruss: memory    dram0: pa 0x4a300000 size 0x2000 va e09b4000
[   20.146116] pruss-rproc 4a300000.pruss: memory    dram1: pa 0x4a302000 size 0x2000 va e09b8000
[   20.146137] pruss-rproc 4a300000.pruss: memory shrdram2: pa 0x4a310000 size 0x3000 va e09bc000
[   20.146157] pruss-rproc 4a300000.pruss: memory     intc: pa 0x4a320000 size 0x2000 va e09c0000
[   20.146177] pruss-rproc 4a300000.pruss: memory      cfg: pa 0x4a326000 size 0x2000 va e09c4000
[   20.146598] pruss-rproc 4a300000.pruss: creating platform devices for PRU cores
[   20.241161] pru-rproc 4a334000.pru0: memory     iram: pa 0x4a334000 size 0x2000 va e09c8000
[   20.241245] pru-rproc 4a334000.pru0: memory  control: pa 0x4a322000 size 0x400 va e09cc000
[   20.241269] pru-rproc 4a334000.pru0: memory    debug: pa 0x4a322400 size 0x100 va e09ce400
[   20.241507]  remoteproc1: 4a334000.pru0 is available
[   20.241520]  remoteproc1: Note: remoteproc is still under development and considered experimental.
[   20.241529]  remoteproc1: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
[   20.245483]  remoteproc1: Direct firmware load for am335x-pru0-fw failed with error -2
[   20.245518]  remoteproc1: failed to load am335x-pru0-fw
[   20.301460] pru-rproc 4a334000.pru0: booting the PRU core manually
[   20.301497]  remoteproc1: powering up 4a334000.pru0
[   20.301578]  remoteproc1: Direct firmware load for am335x-pru0-fw failed with error -2
[   20.301596]  remoteproc1: request_firmware failed: -2
[   20.306791] pru-rproc 4a334000.pru0: rproc_boot failed
[   20.707323] davinci_evm sound: hdmi-hifi <-> 48038000.mcasp mapping ok
[   20.728970] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[   20.950841]  remoteproc1: releasing 4a334000.pru0
[   20.951046] pru-rproc: probe of 4a334000.pru0 failed with error -2
[   20.951229] pru-rproc 4a338000.pru1: memory     iram: pa 0x4a338000 size 0x2000 va e09e0000
[   20.951278] pru-rproc 4a338000.pru1: memory  control: pa 0x4a324000 size 0x400 va e09de000
[   20.951300] pru-rproc 4a338000.pru1: memory    debug: pa 0x4a324400 size 0x100 va e09e4400
[   20.951522]  remoteproc1: 4a338000.pru1 is available
[   20.951535]  remoteproc1: Note: remoteproc is still under development and considered experimental.
[   20.951545]  remoteproc1: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
[   20.951873]  remoteproc1: Direct firmware load for am335x-pru1-fw failed with error -2
[   20.951895]  remoteproc1: failed to load am335x-pru1-fw
[   20.970940] pru-rproc 4a338000.pru1: booting the PRU core manually
[   20.970976]  remoteproc1: powering up 4a338000.pru1
[   20.971047]  remoteproc1: Direct firmware load for am335x-pru1-fw failed with error -2
[   20.971067]  remoteproc1: request_firmware failed: -2
[   20.976264] pru-rproc 4a338000.pru1: rproc_boot failed
[   21.407501]  remoteproc1: releasing 4a338000.pru1
[   21.417265] pru-rproc: probe of 4a338000.pru1 failed with error -2
[   23.464575] bone_capemgr bone_capemgr: part_number 'cape-universaln', version 'N/A'
[   23.464618] bone_capemgr bone_capemgr: slot #4: override
[   23.464636] bone_capemgr bone_capemgr: Using override eeprom data at slot 4
[   23.464654] bone_capemgr bone_capemgr: slot #4: 'Override Board Name,00A0,Override Manuf,cape-universaln'
[   23.939627] gpio-of-helper ocp:cape-universal: Allocated GPIO id=0
[   23.939887] gpio-of-helper ocp:cape-universal: Allocated GPIO id=1
[   23.940098] gpio-of-helper ocp:cape-universal: Allocated GPIO id=2
[   23.951933] gpio-of-helper ocp:cape-universal: Allocated GPIO id=3
[   23.952325] gpio-of-helper ocp:cape-universal: Allocated GPIO id=4
[   23.952562] gpio-of-helper ocp:cape-universal: Allocated GPIO id=5
[   23.952781] gpio-of-helper ocp:cape-universal: Allocated GPIO id=6
[   23.952983] gpio-of-helper ocp:cape-universal: Allocated GPIO id=7
[   23.953170] gpio-of-helper ocp:cape-universal: Allocated GPIO id=8
[   23.953355] gpio-of-helper ocp:cape-universal: Allocated GPIO id=9
[   23.953535] gpio-of-helper ocp:cape-universal: Allocated GPIO id=10
[   23.953718] gpio-of-helper ocp:cape-universal: Allocated GPIO id=11
[   23.953915] gpio-of-helper ocp:cape-universal: Allocated GPIO id=12
[   23.954095] gpio-of-helper ocp:cape-universal: Allocated GPIO id=13
[   23.954284] gpio-of-helper ocp:cape-universal: Allocated GPIO id=14
[   23.954464] gpio-of-helper ocp:cape-universal: Allocated GPIO id=15
[   23.954653] gpio-of-helper ocp:cape-universal: Allocated GPIO id=16
[   23.954846] gpio-of-helper ocp:cape-universal: Allocated GPIO id=17
[   23.955027] gpio-of-helper ocp:cape-universal: Allocated GPIO id=18
[   23.955210] gpio-of-helper ocp:cape-universal: Allocated GPIO id=19
[   23.955489] gpio-of-helper ocp:cape-universal: Allocated GPIO id=20
[   23.955692] gpio-of-helper ocp:cape-universal: Allocated GPIO id=21
[   23.955888] gpio-of-helper ocp:cape-universal: Allocated GPIO id=22
[   23.956075] gpio-of-helper ocp:cape-universal: Allocated GPIO id=23
[   23.956266] gpio-of-helper ocp:cape-universal: Allocated GPIO id=24
[   23.956457] gpio-of-helper ocp:cape-universal: Allocated GPIO id=25
[   23.956638] gpio-of-helper ocp:cape-universal: Allocated GPIO id=26
[   23.956826] gpio-of-helper ocp:cape-universal: Allocated GPIO id=27
[   23.957008] gpio-of-helper ocp:cape-universal: Allocated GPIO id=28
[   23.957198] gpio-of-helper ocp:cape-universal: Allocated GPIO id=29
[   23.957395] gpio-of-helper ocp:cape-universal: Allocated GPIO id=30
[   23.957578] gpio-of-helper ocp:cape-universal: Allocated GPIO id=31
[   23.957592] gpio-of-helper ocp:cape-universal: ready
[   23.992823] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 192, base_baud = 3000000) is a 8250
[   24.016939] 48024000.serial: ttyS2 at MMIO 0x48024000 (irq = 193, base_baud = 3000000) is a 8250
[   24.023140] 481a8000.serial: ttyS4 at MMIO 0x481a8000 (irq = 194, base_baud = 3000000) is a 8250
[   24.082463] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz
[   24.109242] bone_capemgr bone_capemgr: slot #4: dtbo 'cape-universaln-00A0.dtbo' loaded; overlay id #0
[   24.866339] omap2_mcspi 48030000.spi: registered master spi1
[   24.869239] CAN device driver interface
[   24.882869] spi spi1.1: setup: speed 16000000, sample leading edge, clk normal
[   24.882910] spi spi1.1: setup mode 0, 8 bits/w, 16000000 Hz max --> 0
[   24.883154] omap2_mcspi 48030000.spi: registered child spi1.1
[   24.883304] spi spi1.0: setup: speed 16000000, sample trailing edge, clk normal
[   24.883321] spi spi1.0: setup mode 1, 8 bits/w, 16000000 Hz max --> 0
[   24.883476] omap2_mcspi 48030000.spi: registered child spi1.0
[   24.909027] omap2_mcspi 481a0000.spi: registered master spi2
[   24.928527] spi spi2.1: setup: speed 16000000, sample leading edge, clk normal
[   24.928568] spi spi2.1: setup mode 0, 8 bits/w, 16000000 Hz max --> 0
[   24.928814] omap2_mcspi 481a0000.spi: registered child spi2.1
[   24.928974] spi spi2.0: setup: speed 16000000, sample trailing edge, clk normal
[   24.928992] spi spi2.0: setup mode 1, 8 bits/w, 16000000 Hz max --> 0
[   24.929207] omap2_mcspi 481a0000.spi: registered child spi2.0
[   24.977724] c_can_platform 481cc000.can: c_can_platform device registered (regs=fa1cc000, irq=203)
[   25.001516] c_can_platform 481d0000.can: c_can_platform device registered (regs=fa1d0000, irq=204)

Handy Python Notes

How to initialize a list in python and assign values to the fields in the list dynamically 

>>> print (a)
['', '']

>>> print (a[0])
>>> print (a[1])

>>> a[0] = "asdfasdf"
>>> a[1] = "asdfasdffsadf"
>>> print (a)
['asdfasdf', 'asdfasdffsadf']

Structure in C 'vs' Class in Python 
A C struct as a way to organize data, while a Python (or C++ or Objective-C) "class" is a way to organize not only your data, but the operations for that data.
The big difference is that in Python (and other object oriented languages such as C++, Java, or C#), a class can also have functions associated with it that operate only on the instance of the class, whereas in C, a function that wishes to operate on a struct must accept the structure as a parameter in some way, usually by pointer.

Basic python program to understand attributes, classes, objects, methods and constructors, in python.
self as it suggests, refers to itself- the object which has called the method.
That is, if you have N objects calling the method, then self.a will refer to a
separate instance of the variable for each of the N objects. Imagine N copies
of the variable a for each object

__init__ is what is called as a constructor in other OOP languages such as
C++/Java. The basic idea is that it is a special method which is automatically
called when an object of that Class is created

###############################################################
# A CLASS IS A TEMPLETE FOR CREATING OBJECTS.
###############################################################
class player:
    name = "default"      # Attribute of a class.
    grand_slams = 0       # Attribute of a class.
    l_r_hander='default'  # Attribute of a class.

    #########################################################################
    # Once, there are attributes that “belong” to the class,                #
    # you can define functions/Method that will access the class attribute. #
    #########################################################################
    def player_nickname(self, nick_name):
        self.name = nick_name  # 'self' is the keyword that is used by a method
                               # to access the attribute of the class in which
                               # the method is defined.

    ##############################################################################
    # The name of a constructor is always the same, __init__().                  #
    # The constructor can accept arguments when necessary to create the object.  #
    # When you create a class without a constructor, Python automatically        #
    # creates a default constructor for you that doesn’t do anything.            #
    # Every class must have a constructor, even if it simply relies on the       #
    # default constructor.                                                       #
    # USING THIS, THE VALUES OF ATTRIBUTES CAN BE PROVIDED AT RUNTIME.           #
    ##############################################################################
    def __init__(self, nick_name):
        self.name = nick_name
        print ("contructor in class %s" %(self.name))

print (player.name, ' ', player.grand_slams)
print (player)

###############################################################
# THE BELOW ARE INSTANCES OF A CLASS. THEY ARE CALLED OBJECTS.
###############################################################

print ("##################################################################")
player1 = player("Fedex")
player2 = player("Rafa")
player3 = player("Djoker")
print ("##################################################################")

##############################################################
# this will print address of the instance of 'player' object
##############################################################
print (player1)
print (player2)
print (player3)


##############################################################
# NOW UPDATE THE VARIABLE VALUES IN RESPECTIVE CLASSES.
##############################################################


##################################################

# Object 1
##################################################
print ("##############################################################")
player1.name = "Roger Federer"          # Attribute
player1.grand_slams = 20                # Attribute
player1.l_r_hander  = 'Right'           # Attribute
print ("%s %s %s" %(player1.name, player1.grand_slams, player1.l_r_hander))
player1.player_nickname("Fedex")        # Method
print ("%s %s %s" %(player1.name, player1.grand_slams, player1.l_r_hander))
print ('##############################################################')

#################################################
# Object 2
#################################################
player2.name = "Rafael Nadal"
player2.grand_slams = 17
player2.l_r_hander  = 'left'
print ("%s %s %s" %(player2.name, player2.grand_slams, player2.l_r_hander))
player2.player_nickname("Rafa")        # Method
print ("%s %s %s" %(player2.name, player2.grand_slams, player2.l_r_hander))
print ('##############################################################')

#################################################

# Object 3
#################################################
player3.name = "Novak Djokovic"
player3.grand_slams = 13
player3.l_r_hander  = 'Right'
print ("%s %s %s" %(player3.name, player3.grand_slams, player3.l_r_hander))
player3.player_nickname("Djoker")        # Method
print ("%s %s %s" %(player3.name, player3.grand_slams, player3.l_r_hander))
print ('##############################################################')



Search for a file in directories in python recursively.

import os

file_list = []

def search_files(directory='.', extension=''):
    extension = extension.lower()
    for dirpath, dirnames, files in os.walk(directory):
        for name in files:
            if extension and name.lower().endswith(extension):
                file_list.append(name)
                print(os.path.join(dirpath, name))
            elif not extension:
                print(os.path.join(dirpath, name))


if __name__ == '__main__':
   # syntax Directory, filename or extension or substring 
   search_files("D:", "expect")                
   print ("##############################################")
          
   print (file_list)




switch case concept [by using dictionaries]  in python
def one(arg):
    print str(arg) + "January"

def two(arg):
    print str(arg) + "February"

def three(arg):
    print str(arg) + "March"

def four(arg):
    print str(arg) + "April"

def five(arg):
    print str(arg) + "May"

def six(arg):
    print str(arg) + "June"

def seven(arg):
    print str(arg) + "July"

def eight(arg):
    print str(arg) + "August"

def nine(arg):
    print str(arg) + "September"

def ten(arg):
    print str(arg) + "October"

def eleven(arg):
    print str(arg) + "November"

def twelve(arg):
    print str(arg) + "December"


def numbers_to_months(argument, arg):
    switcher = {
        1: one,
        2: two,
        3: three,
        4: four,
        5: five,
        6: six,
        7: seven,
        8: eight,
        9: nine,
        10: ten,
        11: eleven,
        12: twelve
    }
    # Get the function from switcher dictionary
    func = switcher.get(argument, lambda: "Invalid month")
    # Execute the function
    func(arg)

'''
###########################################################################
# Main code starts Here
###########################################################################
'''
numbers_to_months(1, 1234)

Validate whether a string is subset of another string or not
def validate_substring_in_string(substring, text):
    if text.find(substring) != -1:
        print "substring is subset of main string"
        return 0
    else:
        print "No substring found"
        return 1

validate_substring_in_string("robot dance", "show me robot dance")



Common Semaphore Errors

This is borrowed form https://github.com/Yawolf/semaphores


Common Errors

The incorrect use of semaphores can result in several errors that are very difficult to detect.
In this case, execute a sem_post before a sem_wait may allow other proccesses execute a critical section simultaneously:
sem_open(semaphore,1,Sem),
sem_post(Sem),
%% CRITICAL SECTION
sem_wait(Sem).
Another common error is execute two sem_wait consecutively in a semaphore with value 1, the result is a deadlock and no process can continue executing:
sem_open(semaphore,1,Sem),
sem_wait(Sem),
%% CRITICAL SECTION
sem_wait(Sem).
Take care when are you closing the semaphore, maybe you close a semaphore at the end of a process but there are one or more processes using the same semaphore, this can result in serious errors:
Process 1
sem_open(semaphore,1,Sem),
sem_wait(Sem),
%% CRITICAL SECTION
sem_post(Sem),
sem_close(Sem).
Process 2
sem_open(semaphore,1,Sem),
sem_wait(Sem),
%% CRITICAL SECTION
sem_post(Sem),
sem_close(Sem).
The correct way is:
Process 1
sem_open(semaphore,1,Sem),
sem_wait(Sem),
%% CRITICAL SECTION
sem_post(Sem).
Process 2
sem_open(semaphore,1,Sem),
sem_wait(Sem),
%% CRITICAL SECTION
sem_post(Sem).
Main process
sem_open(semaphore,1,Sem),
process_call('process_1',[],[background(P1)]),
process_call('process_2',[],[background(P2)]),
process_join(P1), process_join(P2),
sem_close(Sem).
Remember that sem_open create a new semaphore or open the semaphore if it exists

Unix domain client server communication in python


server.py 

import socket
import sys
import os

server_address = './uds_socket'
recv_buf = 1024


# Make sure the socket does not already exist
try:
    os.unlink(server_address)
except OSError:
    if os.path.exists(server_address):
        raise


# Create a UDS socket
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)

# Bind the socket to the port
print >>sys.stderr, 'starting up on %s' % server_address
sock.bind(server_address)

# Listen for incoming connections
sock.listen(1)

while True:
    # Wait for a connection
    print >>sys.stderr, 'waiting for a connection'
    connection, client_address = sock.accept()
    try:
        print >>sys.stderr, 'connection from', client_address

        # Receive the data in small chunks and retransmit it
        data = connection.recv(recv_buf)
        print >>sys.stderr, 'received "%s"' % data
           
    finally:
        # Clean up the connection
        connection.close()
       



####################################################################
Set timeout for server socket. If server socket doesn't receive any message from 
client within 5 secs, record the exception and continue.
####################################################################

    sock.settimeout(5.0)

    try:
      connection, client_address = sock.accept()
    except socket.timeout:
        print >>sys.stderr, 'sock accept timeout. No message received from client'
        continue
####################################################################


client.py 

import socket
import sys

# Create a UDS socket
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)

# Connect the socket to the port where the server is listening
server_address = './uds_socket'
print >>sys.stderr, 'connecting to %s' % server_address
try:
    sock.connect(server_address)
except socket.error, msg:
    print >>sys.stderr, msg
    sys.exit(1)

try:
   
    # Send data
    message = 'Hi Server.. I am client.'
    print >>sys.stderr, 'sending "%s"' % message
    sock.sendall(message)

finally:
    print >>sys.stderr, 'closing socket'
    sock.close()






Write/Append Dictionaries to CSV file. Read and Scan for required value in the dictionary.

import csv
#----------------------------------------------------------------------
def csv_writer(data, path):
    """
    Write data to a CSV file path
    """
    #with open(path, "wb") as csv_file:
    """
    Append data to a CSV file path
    """
    with open(path, "a+") as csv_file:
        writer = csv.writer(csv_file, delimiter=',')
        for line in data:
            writer.writerow(line)


#----------------------------------------------------------------------
def csv_dict_reader(file_obj):
    """
    Read a CSV file using csv.DictReader
    """
    reader = csv.DictReader(file_obj, delimiter=',')
    for line in reader:
        print(line["first_name"]),
        print(line["last_name"]),
        print(line["city"])

        if (line["first_name"] == "Naga"):
            print "############### CSV FILE SCAN DEMO #################################################" 
            print ('Now seach the value for' + " " +line["first_name"])
            print ('corresponding value for' + ' ' + line["first_name"] + ":" + line["last_name"])
            print "############### FOUND VALUE FROM SCAN. END #########################################" 


def csv_dict_writer(path, fieldnames, data):
    """
    Writes a CSV file using DictWriter
    """
    with open(path, "wb") as out_file:
        writer = csv.DictWriter(out_file, delimiter=',', fieldnames=fieldnames)
        writer.writeheader()
        for row in data:
            writer.writerow(row)


#----------------------------------------------------------------------
if __name__ == "__main__":

   
    print "#################### EXAMPLE 1 ######################"

    print "Writing into output.csv File"
    data = ["first_name,last_name,city".split(","),
            "Neelkanth,Reddy,India".split(","),
            "Naga,Surekha,India".split(","),
            ]
    path = "output.csv"
    csv_writer(data, path)

    print "#####################################################"
    print "Reading from output.csv File"
    print "#####################################################"
    with open("output.csv") as f_obj:
        csv_dict_reader(f_obj)

    print "#####################################################\n"

    print "#################### EXAMPLE 2 ######################"
    data = ["first_name,last_name,city".split(","),
            "Tyrese,Hirthe,Strackeport".split(","),
            "Jules,Dicki,Lake Nickolasville".split(","),
            "Dedric,Medhurst,Stiedemannberg".split(","),
            "Neelkanth,Reddy,India".split(",")
            ]
    my_list = []
    fieldnames = data[0]
    for values in data[1:]:
        inner_dict = dict(zip(fieldnames, values))
        my_list.append(inner_dict)

    path = "output_1.csv"
    csv_dict_writer(path, fieldnames, my_list)

    with open("output_1.csv") as f_obj:
        csv_dict_reader(f_obj)

Python Tkinter: Send Message from a process to GUI process via message queue

###############################################################################
# Send message to GUI process from a process via Message Queue. 

#Note: save a GIF image ["speech-recognition.gif"] with this same in the same folder. 
###############################################################################

from Tkinter import *

import Tkinter as tk
import threading
import multiprocessing
import time

message_rx = ""


class message_queue_class(object):

        def __init__(self, name):
             self.name = name

        def do_something(self):
             global message_rx
             proc_name = multiprocessing.current_process().name
             print 'my name: %s :Message received on queue: %s!' % (proc_name, self.name)
             message_rx = self.name


class App(threading.Thread):

    def __init__(self, tk_root):
        self.root = tk_root
        threading.Thread.__init__(self)
        self.start()

    def run(self):
            global message_rx
            self.root.geometry("1024x810+400+50") 
            photo=PhotoImage(file='speech-recognition.gif')

            # First Create a text box of size 1024x810
            text2 = Text(self.root, height=1024, width=810)

            loop_Active=True
            while loop_Active:
                 # Get message from the message queue when it arrive. Till them remain blocking here.
                 obj = queue.get()
                 obj.do_something()
       
                 # Clear the text in the text box before entering new text
                 text2.delete(1.0,END)
                 # Embed image into the text box.
                 text2.image_create(END, image=photo)
                 text2.tag_configure('big', font=('Verdana', 20, 'bold'))
                 text2.insert(END,'\n' + message_rx, 'big')
                 # Now insert image into text box
                 text2.pack(side=TOP)





##########################################################################
# Create Tx process that would transmit message to message queue
##########################################################################
def tx_process(q):
    print "Starting tx_process"
    loop_Active=True

    #  Keep sending message to GUI process, every 5 secs.
    while loop_Active:
        queue.put(message_queue_class('Hi.. I am Neelkanth'))
        time.sleep(5)
        queue.put(message_queue_class('I am Cp. Sparrow'))
        time.sleep(5)

#######################################################################
# Create a thread that would copy text from thread to GUI.
# GUI will run in main process.
######################################################################
def gui_process(q):
    print "Starting GUI process"

    root = tk.Tk()

    APP = App(root)

    root.mainloop()


#####################################################################################
#                        Main Process Starts Here
#####################################################################################
if __name__ == "__main__":


   queue = multiprocessing.Queue()

   # creating GUI process
   temp = 1
   p1 = multiprocessing.Process(target=gui_process, args=(queue,))
   # Start GUI process
   p1.start()


   # creating a new process 
   p = multiprocessing.Process(target=tx_process, args=(queue,))
   # Starting the new process 
   p.start()

   # Wait for the processes to finish
   queue.close()
   queue.join_thread()
   p.join()
   p1.join()

Message queue to transmit text between 2 processes


######################################################
"Message queue to transmit text between 2 processes"
######################################################


import multiprocessing
class message_queue_class(object):

    def __init__(self, name):
        self.name = name

    def do_something(self):
        proc_name = multiprocessing.current_process().name
        print 'my name: %s :Message received on queue: %s!' % (proc_name, self.name)

def process_2(q):
    obj = q.get()
    obj.do_something()

def process_1(q):
    queue.put(message_queue_class('Hi.. I am Neelkanth'))

if __name__ == '__main__':

    queue = multiprocessing.Queue()

    p = multiprocessing.Process(target=process_1, args=(queue,))
    p.start()
   

    p1 = multiprocessing.Process(target=process_2, args=(queue,))
    p1.start()
   
    # Wait for the process_2 to finish
    queue.close()
    queue.join_thread()
    p.join()

Multi-Process program in python

###################################################

Multi-Process program in python

###################################################

import multiprocessing

# empty list with global scope
result = []

def square_list(mylist):
    """
    function to square a given list
    """
    global result
    # append squares of mylist to global list result
    for num in mylist:
        result.append(num * num)
    # print global list result
    print("Result(in process p1): {}".format(result))

if __name__ == "__main__":
    # input list
    mylist = [1,2,3,4]

    # creating new process
    p1 = multiprocessing.Process(target=square_list, args=(mylist,))
    # starting process
    p1.start()
    # wait until process is finished
    p1.join()

    # print global result list
    print("Result(in main program): {}".format(result))


Developing GUI using Python Tkinter Library

Program 1:  print text(with different colors, font etc) over an Image

import tkinter as tk

counter = 0
def counter_label(label):
  def count():
    global counter
    counter += 1
    label.config(text=str(counter))
    label.after(1000, count)
  count()

root = tk.Tk()
logo = tk.PhotoImage(file="speech-recognition.gif")

explanation = "I am Neelkanth Reddy"
label = tk.Label(root,
             # to proint text on top of image
             compound = tk.CENTER,
             # where the text should be printed on top of image
             text=explanation,
             fg = "red",
      font = "Verdana 60 bold",
             image=logo).pack(side="right")

w = tk.Label(root, fg="green")
w.pack()
counter_label(w)


root.mainloop()


Program 2: Print dynamic counter value on the text

import tkinter as tk
import time
#############################################################
# Global Variables
#############################################################
counter = 0

##############################################################
#  Procedures
##############################################################
def count():
    global counter
    counter += 1
    if (counter <= 100):
        label.config(text=str(counter))
    else :
       label.config(text="End of count")
       exit
 
   # Here 1000 is 1000 ms.
    # This is recursive function
    label.after(1, count)

# print count variable on the screen
def counter_label(label):
  count()


######################################################################
#           Main script starts here. 
######################################################################
root = tk.Tk()
root.title("Speech Recognition")
# Background image
logo = tk.PhotoImage(file="speech-recognition.gif")
label = tk.Label(root,
                 compound = tk.CENTER,
                 image=logo,
                 font = "Verdana 100 bold",
                 fg="Red")
label.pack()
counter_label(label)


root.mainloop()

Python program to write list into csv file and read back into list from 'csv' file

######################################################
Python program to write list into csv file and read back into list from 'csv' file
######################################################

Code : 

import csv
outputFile = open('output.csv', 'w', newline='')
outputWriter = csv.writer(outputFile)
outputWriter.writerow(['spam', 'eggs', 'bacon', 'ham'])
outputWriter.writerow(['Hello, world!', 'eggs', 'bacon', 'ham'])
outputWriter.writerow([1, 2, 3.141592, 4])
outputFile.close()


exampleFile = open('output.csv')
exampleReader = csv.reader(exampleFile)
print('###########################################################')
for row in exampleReader:
  print('Row #' + str(exampleReader.line_num) + ' ' + str(row))

print('###########################################################\n')

Output :

###########################################################
Row #1 ['spam', 'eggs', 'bacon', 'ham']
Row #2 ['Hello, world!', 'eggs', 'bacon', 'ham']
Row #3 ['1', '2', '3.141592', '4']
###########################################################

Encrypting Passwords using Crypt()

Encrypting Passwords using crypt()


Theory:

Function: char * crypt (const char *key, const char *salt)

The crypt function takes a password, key, as a string, and a salt character array which
is described below, and returns a printable ASCII string which starts with another salt.
It is believed that, given the output of the function, the best way to find a key that
will produce that output is to guess values of key until the original value of key is
found.

The salt parameter does two things. Firstly, it selects which algorithm is used, the
MD5-based one or the DES-based one. Secondly, it makes life harder for someone trying to
guess passwords against a file containing many passwords; without a salt, an intruder can
make a guess, run crypt on it once, and compare the result with all the passwords. With a
salt, the intruder must run crypt once for each different salt.

For the MD5-based algorithm, the salt should consist of the string $1$, followed by up to
8 characters, terminated by either another $ or the end of the string. The result of crypt
will be the salt, followed by a $ if the salt didn't end with one, followed by 22
characters from the alphabet ./0-9A-Za-z, up to 34 characters total. Every character in
the key is significant.

For the DES-based algorithm, the salt should consist of two characters from the alphabet
./0-9A-Za-z, and the result of crypt will be those two characters followed by 11 more from
the same alphabet, 13 in total. Only the first 8 characters in the key are significant.

The MD5-based algorithm has no limit on the useful length of the password used, and is
slightly more secure. It is therefore preferred over the DES-based algorithm.

When the user enters their password for the first time, the salt should be set to a new
string which is reasonably random. To verify a password against the result of a previous
call to crypt, pass the result of the previous call as the salt.

The following short program is an example of how to use crypt the first time a password is
entered. Note that the salt generation is just barely acceptable; in particular, it is not
unique between machines, and in many applications it would not be acceptable to let an
attacker know what time the user's password was last set.*/


Function: char * crypt_r (const char *key, const char *salt, struct crypt_data * data)
The crypt_r function does the same thing as crypt, but takes an extra parameter which
includes space for its result (among other things), so it can be reentrant.
data->initialized must be cleared to zero before the first time crypt_r is called.

The crypt_r function is a GNU extension.
The crypt and crypt_r functions are prototyped in the header crypt.h.

//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//   C program:
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <string.h>

int main(void)
{
    char salt[] = "$1$abcdefgh"; /* This should be random */
    char *password;

    printf("salt is : %s\n", salt);

    /* Read in the user's password and encrypt it. */

    printf("##################################################################\n");
    printf("Enter Original Password\n");
    password = crypt(getpass("Password:"), salt);
    printf("##################################################################\n");

    /* Print the results. */
    puts(password);
    char original_pass[50] = {0};
    strcpy(original_pass, password);


    printf("##################################################################\n");
    char *cur_passwd;
    printf("Enter password same as original password\n");
    cur_passwd = crypt(getpass("Password:"), password);
    /* Print the results. */
    puts(cur_passwd);
    printf("##################################################################\n");

    printf("\n\nCompare Now: Original password: %s Current Password: %s", original_pass, cur_passwd);

    if (strcmp(original_pass, cur_passwd) == 0)
    {
        printf("\n\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
        printf("****************** PASSWORD MATCH *****************\n");
        printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
    } else {
        printf("\n\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
        printf("\nCurrent Password and Original Password Don't Match\n");
        printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
    }

    return 0;
}

Compilation:
gcc -o crypt crypt.c  -lcrypt

Output:

Password match Case:
Neelkanth_221$ ./crypt
salt is : $1$abcdefgh
##################################################################
Enter Original Password
Password:
##################################################################
$1$abcdefgh$Qlx6NNORPMsnE3/ehfisr1
##################################################################
Enter password same as original password
Password:
$1$abcdefgh$Qlx6NNORPMsnE3/ehfisr1
##################################################################


Compare Now: Original password: $1$abcdefgh$Qlx6NNORPMsnE3/ehfisr1 Current Password: $1$abcdefgh$Qlx6NNORPMsnE3/ehfisr1

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
****************** PASSWORD MATCH *****************
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Password No-match Case:

Neelkanth_221$ ./crypt
salt is : $1$abcdefgh
##################################################################
Enter Original Password
Password:
##################################################################
$1$abcdefgh$Qlx6NNORPMsnE3/ehfisr1
##################################################################
Enter password same as original password
Password:
$1$abcdefgh$e.zGC9egaBizsEd9YFd.C.
##################################################################


Compare Now: Original password: $1$abcdefgh$Qlx6NNORPMsnE3/ehfisr1 Current Password: $1$abcdefgh$e.zGC9egaBizsEd9YFd.C.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Current Password and Original Password Don't Match
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@