add 40h protocol support
fix 256 detection
reconcile cherry-pick from master