2019年11月19日 星期二

LTE to clarify

# of cells are supported in 1 BS (BSS + BST + BSC) ?
# of bands are supported in cell ?

LTE procedures overview

Source: https://www.sharetechnote.com/ > LTE

01. UE is Off
02. Power On UE
04. Timing Sync
     Time and Frame Synchronization : In this process, PSS and SSS will be decoded as well.
             PCI (Physical Cell ID) is derived (a.k.a PCI detection)
05. Cell Search : Normally a UE would find multiple cells in this process 
07. MIB decoding
      UE can figure out System Bandwidth and Transmission Mode in this process. 
      (As you see in Downlink Framestructure, MIB/PBCH is located at the 6 RBs around the 
      center frequency. So the success of MIB decoding does not guarantee that signal quality
      across the whole band is good)
      Detect CSR (Cell Specific Reference Signal) and perform Channel Estimation and 
      Equalization. In this process, UE will detect/measure reference signal across the whole
      system bandwidth. So RSRP/RSRQ measured at this step can be a good indicator for 
      overall signal quality.
      Decode PDCCH and extract DCI information for SIB. PDCCH is spread across the whole 
      bandwidth, so the signal quality across the whole bandwidth should be good enough 
      for this step.
08. SIB deconding (SIB1 should be decoded first and then SIB2 and then remaining SIBs)
      Cell Selection: UE tries camp on to HPLM cell with the highest priority.
10. Registration/Authentication/Attach
11. Default EPS Bearer Setup
      11.A Now UE is in IDLE Mode
      11.B (If the current cell become weak or UE moves to another cell regisn) Cell Reselection
12. (When Paging message comes or User make a call) RACH Process
13. Setup Dedicated EPS Bearer
      13.A Receive data
      13.B Transmit data
              (Full duplex is possible for FDD bands)
      13.C (If UE power is percieved too weak by the network)
              Network send TPC command to increase UE Tx Power
             (If UE power is percieved too strong by the network)
              Network send TPC command to decrease UE Tx Power
14. (If UE moves to another cell region) Network and UE perform Handover procedure
15. User stop call and UE gets into IDLE mode

2019年11月6日 星期三

Generating 0xFF

Source https://superuser.com/questions/274972/how-to-pad-a-file-with-ff-using-dd

As far as I know there is no way to tell dd to pad using 0xFF. But there is a workaround.
First create a file with the required length filled with 0xFF:
$ dd if=/dev/zero ibs=1k count=100 | tr "\000" "\377" >paddedFile.bin
100+0 records in
200+0 records out
102400 bytes (102 kB) copied, 0,0114595 s, 8,9 MB/s
tr is used to replace zeroes with 0xFF. tr expects arguments in octal. 0xFF in octal is \377.
Result:
$ hexdump -C paddedFile.bin 
00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00019000
Then insert the input file at the beginning of the "padded" file:
$ dd if=inputFile.bin of=paddedFile.bin conv=notrunc
0+1 records in
0+1 records out
8 bytes (8 B) copied, 7,4311e-05 s, 108 kB/s
Note the conv=notrunc which tells dd to not truncate the output file.
Example input file:
$ hexdump -C inputFile.bin 
00000000  66 6f 6f 0a 62 61 72 0a                           |foo.bar.|
00000008
Result:
$ hexdump -C paddedFile.bin 
00000000  66 6f 6f 0a 62 61 72 0a  ff ff ff ff ff ff ff ff  |foo.bar.........|
00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00019000

2019年10月19日 星期六

AttributeError: 'NoneType' object has no attribute 'rstrip

Full error log:
yulin@WNC:/work/yulin/cat9640$ repo forall -c "pwd"                                 
Traceback (most recent call last):                                                 
  File "/work/yulin/cat9640/.repo/repo/main.py", line 531, in                
    _Main(sys.argv[1:])                                                             
  File "/work/yulin/cat9640/.repo/repo/main.py", line 507, in _Main                 
    result = repo._Run(argv) or 0                                                   
  File "/work/yulin/cat9640/.repo/repo/main.py", line 180, in _Run                 
    result = cmd.Execute(copts, cargs)                                             
  File "/work/yulin/cat9640/.repo/repo/subcmds/forall.py", line 226, in Execute     
    projects = self.GetProjects(args, groups=opt.groups)                           
  File "/work/yulin/cat9640/.repo/repo/command.py", line 140, in GetProjects       
    all_projects_list = manifest.projects                                           
  File "/work/yulin/cat9640/.repo/repo/manifest_xml.py", line 350, in projects     
    self._Load()                                                                   
  File "/work/yulin/cat9640/.repo/repo/manifest_xml.py", line 428, in _Load         
    self._ParseManifest(nodes)                                                     
  File "/work/yulin/cat9640/.repo/repo/manifest_xml.py", line 481, in _ParseManifest
    remote = self._ParseRemote(node)                                               
  File "/work/yulin/cat9640/.repo/repo/manifest_xml.py", line 657, in _ParseRemote 
    return _XmlRemote(name, alias, fetch, pushUrl, manifestUrl, review, revision)   
  File "/work/yulin/cat9640/.repo/repo/manifest_xml.py", line 78, in __init__       
    self.resolvedFetchUrl = self._resolveFetchUrl()                                 
  File "/work/yulin/cat9640/.repo/repo/manifest_xml.py", line 88, in _resolveFetchUrl
    manifestUrl = self.manifestUrl.rstrip('/')                                     
AttributeError: 'NoneType' object has no attribute 'rstrip'                         
yulin@WNC:/work/yulin/cat9640$                                                     

Debug#1
Refer to https://groups.google.com/forum/#!topic/android-building/0QkvGAQJ_Kg.
Adding alias to remotes fails to fix this issue.

Debug#2
 Add debug logs in manifest_xml.py
----------------------------------------------------------------------------------------------------------
class _XmlRemote(object):
  def __init__(self,
               name,
    ...
    self.revision = revision   
+ print('Yulin._XmlRemote.__init__:name=',name,'fetch=',fetch,'pushUrl=',pushUrl,'manifestUrl=',manifestUrl,'alias=',alias,'review=',review,'revision=',revision)
    self.resolvedFetchUrl = self._resolveFetchUrl()

  def _resolveFetchUrl(self):
+    print('Yulin._XmlRemote._resolveFetchUrl:fetchUrl=',self.fetchUrl)
    url = self.fetchUrl.rstrip('/')
    manifestUrl = self.manifestUrl.rstrip('/')
----------------------------------------------------------------------------------------------------------
Yulin._XmlRemote.__init__:name= hal fetch= ssh://wnc-integrator@wnc_hal/home/wnc-i                                                                                      ntegrator/ pushUrl= None manifestUrl= None alias= None review= None revision= None
Yulin._XmlRemote._resolveFetchUrl:fetchUrl= ssh://wnc-integrator@wnc_hal/home/wnc-                                                                                      integrator/
----------------------------------------------------------------------------------------------------------
Inference: "manifestUrl= None" is the problem.

Solution
Comparing 'git config -l' in .repo/manifests/ btwn OK and NG shows remote origin is missing in NG case.
'git remote add origin ....' fixes this issue.

2019年9月9日 星期一

USB4 1.0 版規範正式釋出,最快 40Gbps 把 USB3、PCIe、DisplayPort 通通包在一起!

Source https://tw.news.yahoo.com/usb4-1-0-%E7%89%88%E8%A6%8F%E7%AF%84%E6%AD%A3%E5%BC%8F%E9%87%8B%E5%87%BA-%E6%9C%80%E5%BF%AB-142536087.html

檢視相片
USB-IF 近年來真的是相當熱鬧,除了從 USB 3.0、USB 3.1、USB 3.2 一路改名改制,今年 Intel 強勢主導的 Thunderbolt 3 也將會是下一世代選用重點之一,如今 USB4 1.0 版規範正式於 USB-IF 網站推出,不僅速度更快,也要加強宣傳 Type-C,以及 Type-C 傳輸內容功能多樣化。
USB-IF 近日終於公布 USB4 1.0 版規範,實體介面連接埠同樣拋棄使用已久的 Type-A、Type-B,改採 Type-C 形式, Type-C 支援單通道、雙通道傳輸模式,且 USB4 最快速度將從 USB 3.2 的 Gen2 x 2 20Gbps 提升至 Gen3 x 2 40Gbps。此外為向下相容,USB 2.0 High Speed 世代以前的訊號傳輸仍自行獨立,不包在 USB4 封包裡一同傳輸。(Gen2 要求傳輸路徑總插入損失於 5GHz 不得超過 17.5dB、Gen3 則是於 10GHz 不得超過 15dB,對於線材品質有更高的要求。)
檢視相片
▲ USB4 系統架構圖,可以見到 USB 2.0 訊號採用獨立路徑傳輸。
另外一向較為重要的改革,則是 USB4 變更為 Tunnel 隧道式協定,USB4 封包不僅僅能夠傳遞自己的資料,USB3、DisplayPort、PCIe 訊號也能夠包在 USB4 封包裡進行傳輸,共享最高 40Gbps 傳輸頻寬。
檢視相片

▲ USB4 可使用 1 對線材(SBTX/SBRX)與 1 個旁通通道(用以初始化 USB4 連結與管理)進行單通道傳輸,亦可透過 2 對線材與 1 個旁通通道進行雙通道傳輸。
檢視相片

▲ USB3 訊號透過隧道方式於 USB4 結構當中的傳輸路徑圖。
檢視相片

▲ PCIe 訊號透過隧道方式於 USB4 結構當中的傳輸路徑圖。
檢視相片

▲ DispalyPort 1.4a 訊號同樣透過 USB4 隧道式協定進行傳輸,僅在左端訊號輸入與右端訊號輸出採用 DisplayPort 規範。
與前一世代相同,USB4 主機端不一定要支援所有的功能集,但最少需要支援 Gen2 x 2 20Gbps 以及 DisplayPort Alt Mode,其餘 PCIe 控制器、Gen3 x 2 40Gbps 在主機端則是選用功能。
主機端 Thunderbolt 3 支援性部分,USB4 同樣將其定位在選用功能集,採用 Thunderbolt Alt Mode 方式傳輸,支援 Gen2 10.3125Gbps 與 Gen3 20.625 Gbps,不過要求 USB4 集線器需於所有 DFP(Downstream Facing Port)加入與 Thunderbolt 3 的交互相容性。因此過去 Type-C 連接埠功能標示不清,讓人摸不著頭緒的情形,依然會發生在 USB4 規格之中。(註:DisplayPort Alt Mode 和 Thunderbolt Alt Mode 另行定義於 USB Type-C Specification。)

檢視相片

▲ USB4 溝通與各項功能層的對應圖。
這份 USB4 1.0 版規範由數個大公司共同簽屬發布,包含 Apple、HP、Intel、Microsoft、Renesas、STMicroelectronics、Texas Instruments,由於晶片製造與整合需要一段時間,最快有望於 2020 年下半年見到第一批支援 USB4 規範的產品上市,且仍需等待 USB-IF 公布 USB4 圖像標誌。

2019年9月8日 星期日

Ubuntu PuTTY UART PL2303

sudo lsusb
sudo modprobe usbserial vendor=0x0557 product=0x2008
sudo dmesg | grep 'ttyUSB'
sudo chmod 777 /dev/ttyUSB0

sudo minicom -s

sudo putty /dev/ttyUSB0 -serial -sercfg 115200,8,n,1,N
sudo cu -l /dev/ttyUSB0 -s 115200


2019年8月18日 星期日

禁止普通使用者查看dmesg資訊

Source:

dmesg能夠輸出kernel ring buffer中的內容,這些內容中可能會包含一些敏感資訊。

根據 kernel docs 中的說明:


This toggle indicates whether unprivileged users are prevented from using dmesg(8) to view messages from the kernel’s log buffer. When dmesg_restrict is set to (0) there are no restrictions. When dmesg_restrict is set set to (1), users must have CAP_SYSLOG to use dmesg(8). The kernel config option CONFIG_SECURITY_DMESG_RESTRICT sets the default value of dmesg_restrict.

我們可以通過設置內核參數 dmesg_restrict 為 1 的方式來禁止普通使用者查看demsg資訊


sudo sysctl -w kernel.dmesg_restrict=1

我們來看一下現在 dmesg_restrict 的值是什麼


sysctl kernel.dmesg_restrict

kernel.dmesg_restrict = 1

現在再來用普通用戶執行demsg:


[lujun9972@T520 wikit.docker]$ dmesg

dmesg: 讀取內核緩衝區失敗: 不允許的操作

會發現提示無法讀取內核緩衝區

要讓該設置永久生效,則需要修改 /etc/sysctl.conf 文件


sudo echo 'kernel.dmesg_restrict=1' >> /etc/sysctl.conf