۱۳۹۱ آذر ۶, دوشنبه

Debian on my new Samsung Series 9 13.3" -- NP900X3C

I got this new laptop and I've installed Debian on that. I had to do some tricks to make it work fine. I've also used help from many other blog posts like here, here, and here.

USB Booting:
I had to disable fast bios boot and press F10 to get the boot menue. Setting the priorities in BIOS didn't work. This thread helped a lot. It is also reported that the right USB 2.0 port works fine in contrast to the left USB 3.0 port.

Kernel:
Debian kernel on Wheezy at this point is too old for this laptop. The brightness buttons does not work due to a known bug in kernel which is fixed nowadays and that's why I migrated to liquorix kernel. The other reason was that the original kernel which was 3.2, used to just hang and go to not responding mode once a while. Right now there is a problem with rtl firmwares and the liquorix new releases and I'm trying to figure out how to workaround/fix it.
Edit: installing firmware-realtek fixed the problem.

Touchpad & Synaptics:
I also had to tweak synaptics settings a lot, and here is the result. I also had to prevent gnome from changing these setting which I got from here, by this (Quoted):

Gnome settings daemon may override existing settings (for example ones set in xorg.conf.d) for which there is no equivalent in any of the graphical configuration utilities. It is possible to stop gnome from touching mouse settings at all:
  1. Run dconf-editor
  2. Edit /org/gnome/settings-daemon/plugins/mouse/
  3. Uncheck the active setting


For my future reference, here is my synaptics config, put in /etc/X11/xorg.conf

Section "InputClass"
        Identifier      "Clickpad"                      # required
        MatchIsTouchpad "yes"                           # required
        Driver          "synaptics"                     # required
        Option          "SHMConfig"             "1"
        Option          "MinSpeed"              "0.8"
        Option          "MaxSpeed"              "1.2"
        Option          "AccelFactor"           "0.15"
        Option          "TapButton1"            "1"
        Option          "TapButton2"            "3"     # multitouch
        Option          "TapButton3"            "2"     # multitouch
        Option          "VertTwoFingerScroll"   "1"     # multitouch
        Option          "HorizTwoFingerScroll"  "1"     # multitouch
        Option          "VertEdgeScroll"        "0"
        Option          "HorizEdgeScroll"       "0"
        Option          "CoastingSpeed"         "8"
        Option          "CornerCoasting"        "1"
        Option          "CircularScrolling"     "1"
        Option          "CircScrollTrigger"     "7"
        Option          "EdgeMotionUseAlways"   "0"
        Option          "ClickPad"              "1"
        Option          "LockedDrags"           "1"
        Option          "LockedDragTimeout"     "5000"
        Option          "FingerHigh"            "14"
        Option          "FingerLow"             "10"
        Option          "FingerPress"           "255"
        Option          "PalmDetect"            "1"
        Option          "PalmMinWidth"          "10"
        Option          "PalmMinZ"              "200"
EndSection

Also to prevent accidental clicks while typing, have this in /etc/X11/Xsession.d/98x11-syndaemon (got it from here):
/usr/bin/syndaemon -d -t -k

Wireless:
This package contains the wireless firmware on this laptop: firmware-iwlwifi

Screen Brightness:
If you don't want to install liquorix kernel but wish to be able to change your screen brightness, this script might help (need to be su):
#!/bin/sh
echo $1 > /sys/class/backlight/acpi_video0/brightness

Keyboard Backlit:
Initially buttons do not work, but this helps (need to be su):
#!/bin/sh
echo $1 > /sys/devices/platform/samsung/leds/samsung\:\:kbd_backlight/brightness
FN Keys:
Alternatively you can make FN keys handle the keyboard backlit, wireless, performance mode, and battery life extender for you. Here is the page I used to have them working; but some changes needed to be applied for my preferences and hardware.
One thing is my keyboard is input/event0, and not input/event4. You can find your keyboard using /lib/udev/findkeyboards. Another thing is my FN+F11 code is 0xB3. I also changed and added some scripts to have notification about current status of what has been changed.
Okay, now to make it short and simple, here is the report of what I've done, and you can read the referenced page for more information.
My /lib/udev/keymaps/samsung-other file is like this:

0x74 prog1 # User key
0x75 www
0x78 mail
0x82 switchvideomode # Fn+F4 CRT/LCD (high keycode: "displaytoggle")
0x83 battery
0x84 prog1
0x86 wlan
0x88 brightnessup
0x89 brightnessdown
0xB1 prog2
0xB3 prog3 
0xB4 wlan 
0xF7 f22 
0xF9 f23 
0x96 kbdillumup
0x97 kbdillumdown
0xCE prog1 
0xD5 wlan 
Some of them are extra, I just didn't remove them. Then here it comes /lib/udev/keymaps/force-release/samsung-other file:
0x82
0x83
0x84
0x86
0x88
0x89
0xB3
0xF7
0xF9
0x96
0x97
0xCE
0xD5
Then here is what I've added to the /etc/sudoers file:
Cmnd_Alias SAMCTL = /home/adrin/bin/samctl.sh batt, \
            /home/adrin/bin/samctl.sh perf, \
            /home/adrin/bin/samctl.sh wlan
Defaults!SAMCTL !requiretty
adrin    ALL=(ALL)   NOPASSWD: SAMCTL
Remember to change "adrin" to your username. Then I have these scripts all in /home/adrin/bin/ path; again remember to change all paths to your correct home folder, or anywhere else you want. Now you might need a reboot to have the keys working, and then add three commands as Custom Shortcuts in gnome3 GUI tool "Keyboard -> Shortcuts -> Custom Shortcuts". I assigned FN+F1 to battery life extender (/home/adrin/bin/samctlbatt.sh), FN+F11 to performance mode changed (/home/adrin/bin/samctlperf.sh), and FN+F12 to WLAN status switcher (/home/adrin/bin/samctlwlan.sh).


Power Consumption:
install laptop-mode-tools
Here is a good tutorial on power management of this laptop and I should remember to use powertop whenever I want more battery, and hit enter on those suggestions to switch their status to Good.

For my own future reference this part is an exact quotation from the same place:


How to get longer battery life

As I said: install powertop. It can even tell you what's drawing how much energy (although this seems not too reliable). Powertop can enable a bunch of power saving options which must be configurable somewhere else too but I haven't figured that out for each. Start it, go to the right-most page and use the 'enter' key to enable them. They seem to stick mostly across reboots but not all of them do so use it whenever you need the battery life. Make sure especially to enable powersaving on the USB channels, one has the webcam which alone can draw 2-3 watts according to powertop.

Second, use the 'silent' performance_level. Set it by echo-ing 'silent' to '/sys/devices/platform/samsung/performance_level'. See more below. In my experience, the laptop is plenty responsive with the CPU speed capped at 800 mhz - as long as you do nothing too fancy.

Third - as you probably won't use it (much), disable the LAN port. Also uses quite some power according to powertop (although I doubt it's accuracy in this, it won't hurt). You can do this in the Bios of the system.

Fourth, enable power saving for the video card by going to Boot Loader in YaST, edit the boot loader options and add this after"Optional Command Line Kernel Parameter" (or editing grub(2) by hand if you're on a less easy distro):
    i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1 acpi_backlight=vendor
See phoronix for more info on these. The acpi_backlight=vendor makes sure the laptop uses intel's backlight interface which goes up and esp down far further than the normal one. It does sometimes lead to quirky behavior so if it doesn't work for you, remove it.

I appreciate his work. There is a problem with setting acpi_backlight=vendor. It seems that intel uses a different range as brightness value, it's not between 0 and 100 anymore. It can be literally 0, which means the display is turned off, and the maximum on my system is 4648. Hence, when you decrease the brightness using keyboard, once it gets bellow 100, you can not increase it again. This command then might help (0 <= N <= 4648):
#!/bin/sh
echo $1 > /sys/class/backlight/intel_backlight/brightness

Debian Related (not the hardware):
Mostly for my own future reference.

Fonts:
Independent of this laptop, this package causes problems on my fonts, removed it: ttf-mscorefonts-installer

sources.list:
Right now, my sources.list is like this:
#

# deb cdrom:[Debian GNU/Linux wheezy-DI-b3 _Wheezy_ - Official Snapshot amd64 NETINST Binary-1 20121012-13:45]/ wheezy main

#deb cdrom:[Debian GNU/Linux wheezy-DI-b3 _Wheezy_ - Official Snapshot amd64 NETINST Binary-1 20121012-13:45]/ wheezy main

deb http://mirrors.ece.ubc.ca/debian/ wheezy main non-free contrib
deb-src http://mirrors.ece.ubc.ca/debian/ wheezy main non-free contrib

deb http://security.debian.org/ wheezy/updates main non-free contrib
deb-src http://security.debian.org/ wheezy/updates main non-free contrib

## Liquorix Kernel by damentz http://www.liquorix.net/ .
# Secure Apt: apt-get install '^liquorix-([^-]+-)?keyring.?'
# Latest "stable" kernel
deb http://liquorix.net/debian/ sid main
# RC/Beta kernels
# deb http://liquorix.net/debian/ sid main future

# sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
#deb http://dl.google.com/linux/talkplugin/deb/ stable main

۱۳۹۱ آذر ۵, یکشنبه

مالیات

امروز از یه جا رد می‌شدم که این تبلیغ رو دیدم که می‌گه برید و حالشو ببرید که حساب پس‌اندازتون پیش مالیات بهش نمی‌خوره. خوب من با اینکه اصلن اصلن به دولت‌ها اعتماد ندارم، اما پایه این هستم به هر حال که مقدار مالیاتی که ملت می‌دن در حد خوبی باشه که سرویس‌های عمومی و امکانات زیادی در اختیار همه باشه. اصلا مهم نیست که این حرف درسته یا نه، اما من از جامعه‌ای که توش همچین تبلیغی دم در بانکش باشه خیلی خیلی بدم میاد. جامعه‌ای که توش مالیات ندادن ارزش حساب بشه.


عقاید

امروز با یکی از رفقا من باب نوشته اخیرش حرف می‌زدم، گفت خوب تو بلاگت بنویس بیام اونجا فحش بدم، دیدم ایده بدی نیست :ی

البته یه کم بحث خیلی زود فلسفی می‌شه و منم اصلا صلاحیت این رو ندارم که در این موارد نظر بدم. اما خوب حالا می‌گم، ولی یادتون باشه که طبق معمول خیلی می‌تونه مضخرف باشه.

نکته اینه که ملت اصلا باید به عقاید هم احترام بگذارن یا نه. یا احترام گذاشتن به عقاید هم یعنی چی و اینا. بعد خوب دوستمون به این نکته اشاره کرده بود که ملت سر عقایدشون کون همدیگه رو پاره کردن. یا یه چیزایی هست که به تاریخ مللی بر می‌گرده که اون عقاید رو داشتن و این حرفا. خوب خیلی متین بود حرفاش. اما یه سری چیزا گفتم اضافه کنم.

یکی اینکه ملت سر این چیزا معمولن بحث می‌کنن بدون اینکه اصلا سر تعاریف اولیش به تفاهم رسیده باشن.  مثلا تو همین نوشته دوستم،‌ اینکه مسلمونا دهن غیر مسلمونا و  به قول خودشون کافرها رو سرویس کردن؛ حالا می‌شه به اون عقاید احترام گذاشت یا نه؟ خوب نکته اصلا اینه که مثلا طرف عقیده داره که یارو کافر هست و نجس؛ این از اینکه به خاطر این عقیده بره کافره رو بکشه که نجاست زمین رو کم کرده باشه کاملا جداست. 

یا اون بحث نازی‌ها که کرده بود، خوب می‌شه مثلا طرف‌دار نازی‌ها بود؟ اصلا این جمله یعنی چی؟ منظور اینه که بریم همه مثلا یهودی‌ها رو بکشیم یا اینکه به نظرمون یهودی‌ها موجودات گهی هستن؟ خوب خیلی راحت اگه مورد اول باشه می‌شه گفت که غلط کردی بشین سر جات بینیم بابا. ولی اگه مورد دوم باشه خوب می‌شه سرش بحث کرد. ممکنه عقیده یارو به نظر ما خیلی مسخره و احمقانه یا هر طوری دیگه‌ای باشه، چه یهودیه چه طرف مقابلش، خوب این هم نظر ماست؛ ولی بعید می‌دونم دلیل بشه که طرف رو از اینکه این عقیده رو داشته باشه بشه محروم کرد. می‌شه باهاش حرف زد و یه سری دلیل آورد که مثلا عقایدش تو سیستم منطقی ما درست نیست. شاید سیستم منطقی ما رو پذیرفت و یه طور دیگه فکر کرد، شاید هم نه. ولی فرق ما با اونا فقط اینه که فرضیات متفاوتی داریم بنابراین نتایج متفاوتی می‌گیریم که میشه عقایدمون. البته الان به وضوح فرض کردم که ملت تو سیستم منطقی زندگی می‌کنن، به وضوح خیلی وقتا این فرض برقرار نیست.

ممکنه یکی بگه خوب یه سری عقاید دیگه خیلی تابلو غلطن. من با این حرف خیلی کنار نمیام چون به محض اینکه بخوایم بگیم یه چیزایی غلطن یه چیزایی درست، دعوامون می‌شه. ترجیح می‌دم فکر کنم که بیشتر یا اختلاف سلیقه هستن یا همون اختلاف پایه‌های منطقی؛ چون اصلا پایه نیستم که خوب و بد و درست و غلط به این راحتی قابل تعریف باشن. حالا اگه یه جماعتی در حد یک جامعه یک سری عقیده داشته باشن که من شخصا باهاشون کنار نیام، یا باید سعی کنم عوضش کنم، یا کنار بیام، یا بیام بیرون و بی‌خیال شم. مثلا مصر انتخابات شد و یارو مسلمونه برنده شد. با فرض اینکه انتخابات درست بوده، خوب ملتش اینو ترجیح دادن دیگه، ممکنه من شخصا نا‌امید شم از اون جماعت، ولی نمی‌تونم بگم نه غلط کردین عوضش کنین که. ولی خوب ممکنه رقبتم به اینکه برم اونجا کمتر شه.

اینا اصلا نتیجش این نیست که من معتقد باشم این سیستم‌ها و عقیده‌ها رو نباید در راستای تغییرشون تلاش کنیم. منظورم فقط اینه که نمی‌شه زور بگیم و مجبورشون کنیم.

یه چیز دیگه هم اینه که مثلا جامعه‌هه معتقد به ولایت فقیه باشه؛ باشه، خوش به حالش، ولی به محض اینکه بخواد به زور یه جای دیگه دست‌کاری کنه، یا اون اتقلابش رو به زور صادر کنه، یا به خاطر اختلاف عقایدش با یه سری آدم دیگه بهشون حمله کنه، دیگه ریده. از طرفی وقتی مردم خودش رو مجبور کنه که یک سری عقیده رو نداشته باشن، یا یک سری عقیده رو داشته باشن، باز هم دیگه ریده. من هیچ‌وقت به خاطر عقاید یک نفر بهش حمله نمی‌کنم، اما اگه به خاطر عقایدم بهم حمله کرد، یا دخالت کرد، وارد جنگ شده و قوانین زمان جنگ با قوانین زمان صلح کاملا متفاوت هستن.

البته خیلی بحث کلی و تخماتیکیه. یکی از دلایلش اینه که اصلا نمی‌شه خط مشخصی کشید بین عقاید و اعمال. ممکنه اصلا یک سری عقیده، عقیده به یک سری موجودیت خارجی باشه تا یک سری مفاهیم انتزاعی. مثلا یک سری اعتقاد داشته باشن یک سری سرویس‌ها بایدعمومی و در اختیار همه باشن، یک سری بر عکس. حالا اینا چطوری با هم برخورد کنن و از چه ابزارهایی حق استفاده دارن؟

شاید قبلا آدم‌ها اینقدر متفاوت فکر نمی‌کردن یا اینکه آدم‌هایی که متفاوت فکر می‌کردن اینقدر کنار هم نبودن، واسه همین خیلی راحت‌تر به این نتیجه می‌رسیدن که با هم دعوا کنن و بجنگن سر عقایدشون، ولی الان خیلی تفاوت‌ها زیاد شده و ملت یه طورایی به این نتیجه رسیدن که بهتره تفاوت‌ها رو بپذیرن، وگرنه یه سره باید بجنگن. اما واقعا تفاوت‌ها خیلی وقت‌ها متناقض می‌شن و در مقابل هم قرار می‌گیرن. حالا اینکه چطوری این تناقض‌ها باید حل بشه و کی این حق و صلاحیت رو داره که  بگه در این مواقع چه باید کرد (منظورم در تک تک مواقعه)، نظر خاصی ندارم.

وای چقدر خذعول گفتم. ولی مزه داد :ی

۱۳۹۱ آذر ۳, جمعه

قانون و خلاقیت

مطمئن نیستم اول راهنمایی بودم یا سوم راهنمایی. معلم اجتماعی یا همچین چیزی برگشت گفت خلاقیت اینه که آدم در حیطه استانداردها بتونه کار جدید کنه، من برگشتم گفتم نه، خلاقیت اینه که آدم مرزهای استانداردها رو گسترش بده.

اون موقع معلمه از حرف من خوشش اومد و گفت براش بنویسم که چی گفتم.

این یادم اومد چون یک سری آدم هستن که همیشه همه قوانین رو دنبال می‌کنن و هیچ وقت هم این سوال براشون پیش نمی‌آد که یه قانون چرا گذاشته شده بوده.

مثل این می‌مونه که مثلا مسلمونا کلی قانون رو دنبال می‌کنن که دینشون گفته و اصلا کسی به این فکر نمی‌کنه که یه سری قانون الان ممکنه کار نکنن هر چقدر هم که تخماتیک باشن.

من معمولا این رو نمی‌گم، ولی یه جایی در عمق وجودم همیشه این هست که فکر می‌کنه خیلی از قوانین مال آدم‌های احمق و خنگه. کلا قصد این رو ندارم که بگم این عقیده درسته، چون کاملا باعث هرج و مرج می‌شه همچین چیزی. اما برای تک تک قوانینی که دنبال می‌کنم باید خودم رو یک طوری قانع کرده باشم. حتی اگر دلیلش این باشه که زور بالا سرم باشه، زورش باید کافی باشه که من رو قانع کنه.

مخصوصا اگه پایه قوانینی که وضع شده طوری باشه که من اصلا پایش نباشم، باز اگه یه کم پایه‌هه رو قبول بدارم، اگه یه سری جا پایه قانون‌ها نباشم ممکنه راحت‌تر کوتاه بیام. اما نه همیشه.

همه این مضخرفات رو گفتم چون یک سری آدم دورم داشتن یک سری قانون خیلی خیلی احمقانه وضع شده توسط دپارتمان آی-تی رو دنبال می‌کردن که هیچ منطقی پشتش نبود.

۱۳۹۱ آذر ۲, پنجشنبه

روشنک و محسن

دیشب بعد از مدت‌ها با روشنک حرف می‌زدم. روشنک و محسن جزو ارزشمندترین آدم‌هایی هستن که تو زندگیم بودن. الان خوب خیلی دورن و خیلی کم ازشون خبر دارم برای همین متاسفانه تو زندگیم نیستن.

اون موقع‌ها که با این جماعت بودم و حرف می‌زدیم/می‌زدن، بهترین دوران زندگیم محسوب می‌شه. دیشب یه ریزه در حد چند جمله که حرف زدیم یاد اون موقع‌ها افتادم و خیلی خیلی دلم تنگ شد. برا آدم‌هاش و برا حرف‌هاش.

برای حتی ۲۰۶ مامان روشنک که من بدون گواهینامه نزدیک بود یک بار باهاش بزنم به ماشین خاله روشنک که مامانش هم توش بود.

کاش یک موقعی دوباره نزدیک باشند. من خیلی آدم «کاشکی« مسلکی نیستم، ولی این آدم‌ها هم خیلی نیستند و ادبیات من خیلی پایین‌تر از اونیه که بتونه منش این جماعت رو توصیف کنه.