What Happens When I Press a Key? - Computerphile

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ส.ค. 2018
  • Just what happens when you hit a key on a computer's keyboard? Dr Steve Bagley takes us on the keypress' journey....
    Watch Part 2 Now: • How Software Deals wit...
    Building the BBC Micro: • Building the BBC Micro...
    Choosing a Password: • How to Choose a Passwo...
    / computerphile
    / computer_phile
    This video was filmed and edited by Sean Riley.
    Computer Science at the University of Nottingham: bit.ly/nottscomputer
    Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

ความคิดเห็น • 351

  • @stefanamg63
    @stefanamg63 6 ปีที่แล้ว +66

    Always nice to see a seemingly simple system explained properly to uncover a hidden complexity I've never given much thought to before. Fascinating video.

  • @adricortesia
    @adricortesia 6 ปีที่แล้ว +83

    "I like my keyboards soft and mushy" quote of the day :D

  • @aapeli4824
    @aapeli4824 6 ปีที่แล้ว +190

    "I like my keyboards soft and mushy" *laughs in mechanical*

    • @avi8aviate
      @avi8aviate 5 ปีที่แล้ว +4

      BHURGVFDI SHOUIE UIEFSL BEVI BUSIOEV VSBUYEOI HUEVSJKD
      Your laugh in mechanical.

    • @avi8aviate
      @avi8aviate 4 ปีที่แล้ว

      @Red Dunkey ygudhhbiuhvjkfkyuhrgnkvhjbikrtuhjgesguhyurhgbjvhgfbvsuyehbnxeruyvhbsiyurghbnvuihsgbxbenuyrghubdfiyugshb

    • @avi8aviate
      @avi8aviate 4 ปีที่แล้ว

      @Red Dunkey uygjvj

    • @Orinslayer
      @Orinslayer 4 ปีที่แล้ว +4

      I find the clickety-clacking to be highly therapeutic.

    • @kirishima4430
      @kirishima4430 3 ปีที่แล้ว +1

      This is just superb, I have been researching "which keys are which notes on a piano?" for a while now, and I think this has helped. You ever tried - Penaycer Rudimentary Preponderance - (just google it ) ? It is an awesome one off guide for discovering how to play the piano easily minus the normal expense. Ive heard some unbelievable things about it and my colleague got amazing results with it.

  • @biehdc
    @biehdc 6 ปีที่แล้ว +256

    it goes through tons of layers of abstractions until it reaches some bad electron based application

    • @adfaklsdjf
      @adfaklsdjf 6 ปีที่แล้ว +12

      This is the real story.

    • @npc6924
      @npc6924 6 ปีที่แล้ว +3

      Or when I'm testing my program, a poorly written SDL application

    • @ThatBrubakerFellow
      @ThatBrubakerFellow 4 ปีที่แล้ว +6

      🤮

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 6 ปีที่แล้ว +38

    10:02 And one nice thing about scan codes is they don’t distinguish between modifier and non-modifier keys; it’s just “key «n» has been pressed” and “key «n» has been released”, it’s up to the software to decide if key «n» is a modifier key or not. And you can distinguish between e.g. left-shift and right-shift (they have different scan codes), and implement other fun custom behaviours.

    • @floxbr9350
      @floxbr9350 2 ปีที่แล้ว +2

      At least for USB: yes, they do. The state of the modifier keys is encoded in a single byte (which indeed allows a distinction between left-shift and right-shift), then other keys are transmitted individually. Sure, the software can decide what to do with that information, but the modifier keys do play a special role from the hardware perspective.

    • @PavitraGolchha
      @PavitraGolchha 7 หลายเดือนก่อน

      ​​@@floxbr9350yeah i learnt that in ben eater's video about usb

  • @noferblatz
    @noferblatz 6 ปีที่แล้ว +107

    One thing not mentioned is the "de-bouncing" circuit. As switches, the keyboard switches tend to "bounce" or "ring". One keypress produced not just one, but multiple key-down and key-up events. The "de-bouncer" ensures that these are picked up by the machine as a single press.

    • @andljoy
      @andljoy 6 ปีที่แล้ว +2

      noferblatz you can also fix this with many many diodes (one for each key) , no ghosting then :)

    • @Thanatos2996
      @Thanatos2996 6 ปีที่แล้ว +9

      Andrew Joy you can use diodes to debounce? I've used caps, but never heard of diodes.

    • @bvbk007
      @bvbk007 6 ปีที่แล้ว +15

      Diodes can't be used for debouncing, usually. I think Andrew is mistaken. Ghosting and debouncing are independent of each other.

    • @raykent3211
      @raykent3211 6 ปีที่แล้ว +3

      bvbk007 I agree with you. Might be worth mentioning software debouncing, that I've used on arduino projects. No extra components, the software does a very crude simulation of an RC network response. Maybe called a boxcar filter?

    • @Thanatos2996
      @Thanatos2996 6 ปีที่แล้ว +1

      bvbk007 ok, just making sure I didn't fall asleep in Electronics or something.

  • @andljoy
    @andljoy 6 ปีที่แล้ว +179

    It depends on the interface, XT, AT and PS/2 (PS/2 and AT are the same with just a new connector ) are interrupts , USB uses polling.
    PS/2 AT etc The computer does nothing , the keyboard controller polls the matrix and sends hardware interrupts to the CPU
    For USB the same thing happens but the keyboard does not send an interrupt, it holds the keys in a buffer till the computer polls it for key presses.
    Language does not change the scan code set ! AT PS/2 USB ect are ALL scan code set 2 , XT is scan code set 1 ( for some reason) and most terminals and pre PC computers mainframes , serial terminals etc use scancode set 3

    • @Dracounius
      @Dracounius 6 ปีที่แล้ว +5

      USB standards specifies a scan code for USB keyboards, it does not use set 2 (AT). Or if does it is non-compliant with the USB standard for keyboards.

    • @andljoy
      @andljoy 6 ปีที่แล้ว

      Yes your correct. But they use the same codes in the background so 2c is Z in USB and in Set 2 so its short hand.

    • @AlexAegisOfficial
      @AlexAegisOfficial 6 ปีที่แล้ว +2

      \[T]/

    • @0LoneTech
      @0LoneTech 6 ปีที่แล้ว +5

      USB is most certainly not using set 2 - for the reason why, look up what the scancode is for the arrow keys, which have a prefix for set 1 compatibility, or the Pause key which is 7 bytes long. USB keycodes are in alphabetic order and Z in particular is 1D (see HID usage tables, section 10 keyboard). Your firmware might be translating it for legacy OS support, however. Set 3 was more logical in that it used a single bit for press/release and one byte for each event. Also, the polling in USB is performed by the host controller, not the CPU, so we still have an interrupt for when things have changed. There are also buffers in both keyboards and port controllers for PS/2, AT etc, but the CPU typically has to handle them byte by byte.

    • @misterhat5823
      @misterhat5823 6 ปีที่แล้ว +10

      I agree. This video is quite oversimplified and erroneous at times.

  • @frognik79
    @frognik79 6 ปีที่แล้ว +24

    Back in the days of windows 95/98 and XP I used ports 0x60 and 0x64 to communicate with the keyboard controller directly and insert characters into the keyboards output buffer which were then read by windows as normal key presses. This let me get past several games anti cheat / botting software.

    • @yourmum69_420
      @yourmum69_420 2 ปีที่แล้ว +2

      why would you want to cheat?

  • @XHappyKillerX
    @XHappyKillerX 6 ปีที่แล้ว +7

    It would be really cool and suit your channel if you made a video about Docker and the differences on how Docker and a full virtual machine realize the virtualization!
    Love your channel!

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 6 ปีที่แล้ว +12

    Newton’s Third Law, action = reaction; contemplate the Zen of physics: when you a press a key, the key presses back.

  • @SteelSkin667
    @SteelSkin667 6 ปีที่แล้ว +36

    Dr. Bagley's shirt needs some texture filtering.

    • @14rs
      @14rs 3 ปีที่แล้ว

      Some ray tracing

  • @mikeklaene4359
    @mikeklaene4359 6 ปีที่แล้ว +1

    Years ago I used to program on a desktop system that used Hall Effect keys. The keyboard was specifically designed for data entry. It was made in Utica, NY and was originally called a Cogar System 4. Later Singer bought the company and called it a Singer 1501. When Singer was bought by ICL it became the ICL 1501.
    A VERY nifty system for its day.

  • @Thanatos2996
    @Thanatos2996 6 ปีที่แล้ว +9

    PS/2 interrupts, USB and Bluetooth do not. With the newer ones, the controllers have a buffer which the OS polls. Also, insulting the IBM model M is a bold strategy Cotton.

  • @jareknowak8712
    @jareknowak8712 6 ปีที่แล้ว +62

    I pushed "H" on keyboard, but nothing happened..... :(
    Does computer have to be turned on?

    • @jeremyelliot4831
      @jeremyelliot4831 6 ปีที่แล้ว +23

      No, computer doesn't need to be on. It sounds like your keyboard is not working. Have you tried restarting your keyboard?

    • @jareknowak8712
      @jareknowak8712 6 ปีที่แล้ว +8

      Jeremy Elliot
      Yes, i tried, with torch, as always. Did not help.
      Maybe it needs new oil and spark plugs?

    • @joedd215
      @joedd215 6 ปีที่แล้ว +3

      We'll it does need the voltage to apply to the rows somehow. Try plugging it into a battery

    • @TruthNerds
      @TruthNerds 5 ปีที่แล้ว +7

      This is normal. You have a French keyboard, and the "H" is silent in French. HTH. HAND.

    • @GaneshMKarhale
      @GaneshMKarhale 4 ปีที่แล้ว

      No, you need to have common sense.

  • @pengowando8325
    @pengowando8325 6 ปีที่แล้ว +1

    I dig how the game Steve thinks up off the top of his head is Quake. Right on mate

  • @adfaklsdjf
    @adfaklsdjf 6 ปีที่แล้ว

    I really appreciated the graphic diagrams.. very well done. Thanks.

  • @jiffylou98
    @jiffylou98 6 ปีที่แล้ว

    Great video! I remember opening up my PSP and wondering how the circuit board worked and how it could tell which button was being pushed when they were both connected

  • @Pedritox0953
    @Pedritox0953 4 ปีที่แล้ว

    Excellent videos Steve!!

  • @vylbird8014
    @vylbird8014 6 ปีที่แล้ว +22

    The M is the epitome of keyboard perfection. There's a reason it is so remembered: It saw satisfying, comfortable, accurate, and near-indestructible. Very few keyboards achieve that level of quality, and those that do achieve it today are designed specifically in imitation of the M's design and always compared to it.

    • @andljoy
      @andljoy 6 ปีที่แล้ว +2

      No way , model F any day !

    • @tyrgoossens
      @tyrgoossens 6 ปีที่แล้ว +2

      The earlier IBM beamspring is probably the best keyboard mechanism ever made. Unfortunately it comes with some real drawbacks like its huge size and complexity of the capacitive sensing circuitry used.

    • @andljoy
      @andljoy 6 ปีที่แล้ว

      Yeh but they are amazing! I love mine. F uses capacitive sensing too but the controller is less fussy about dust etc. Thats why beamsprings come with contamination shields . Or did, they have all rotten away now.

    • @StevePinkham
      @StevePinkham 6 ปีที่แล้ว +1

      Not sure about epitome, but certainly a classic. Have 3 model M keyboards that I used for many years, but now use WASD Code V2 keyboards, with Cherry MX blue switches at home and clears at the office. I like them all better than my M keyboards for layout and feel.

  • @rajpatel5846
    @rajpatel5846 6 ปีที่แล้ว

    You guys make awesome knowledge videos

  • @benjaminwilson9007
    @benjaminwilson9007 6 ปีที่แล้ว

    This explains why when accessing button presses there are the methods GetKeyDown(Key), GetKeyUp(Key), and GetKey(Key). Thank you. And also if anybody knows about Scratch by MIT, their language was not great with those functions. It was very frustrating.
    Also I prefer quieter keyboards because I typically make videos about what typing and the noise in the video is annoying. But if I'm playing League or something I do like to hear that I have indeed pressed a key.

  • @Syncromatic
    @Syncromatic 6 ปีที่แล้ว +2

    Video comes up just as I'm doing an assignment that uses interrupts, instruction pointers and a like. On one hand, it's neat timing. On the other, it's the last thing I wanna see xD

  • @SecularMentat
    @SecularMentat 6 ปีที่แล้ว +2

    Is an IRQ (interrupt request) done by hardware on the cpu?

  • @billaddison82
    @billaddison82 6 ปีที่แล้ว +1

    Nice paper man, very nice touch!

  • @greob
    @greob 6 ปีที่แล้ว +1

    What happens when I press multiple keys at the same time? How do keyboards handle many keys pressed at once? What determines the maximum number of simultaneous key presses? Is it only hardware, or is it also related to the kernel?

  • @g3n3ricnam35
    @g3n3ricnam35 2 ปีที่แล้ว

    Just near the end when you spoke about how the OS handles input, would it be possible (not practical) to leave a computer without resources by using keyboards?

  • @robinrai4973
    @robinrai4973 6 ปีที่แล้ว +12

    After the model m comment
    *audible gasp*

  • @PeterNerlich
    @PeterNerlich 6 ปีที่แล้ว

    How does the computer handle multiple keyboards? Can I tell it to ignore the numlock setting (and regard it as always on) for one specific keyboard only? Do I have to write my own Linux driver for that?

  • @singularity1130
    @singularity1130 6 ปีที่แล้ว +6

    Do touch sensors next!!!

  • @woopygoman
    @woopygoman 6 ปีที่แล้ว +5

    Can you please make a video about the history of focus stealing (foreground window and keyboard cursor) in operating systems and web browsers? It's quite an annoying issue in computing and still hasn't been addressed after decades!

    • @terrylick5908
      @terrylick5908 6 ปีที่แล้ว

      i will look for a link that shows you. thankyou

  • @mannyknowles
    @mannyknowles 5 ปีที่แล้ว

    Questions about the fanfold greenbar paper used in so many of these videos.
    Why/how do they have so much of it?
    Are they using up leftover/surplus inventory from a bygone era?
    Are there still dot matrix printers in use at the university?
    I'm dying to know.

  • @DotBowder
    @DotBowder 6 ปีที่แล้ว +1

    You should make a series out of these, from the keyboard, through the usb/ps2 bus, to the driver, then the os, display driver, monitor, etc. The whole stack from input to output. - or maybe just talk about each piece of the stack for an episode. It's very computerphile centric.

    • @Yazan_Majdalawi
      @Yazan_Majdalawi 11 หลายเดือนก่อน

      I was expecting something like this when I first saw the title, I'm really disappointed :(

  • @Grundibular
    @Grundibular 6 ปีที่แล้ว +9

    11:00 onwards was a bit lacking in detail. HOW does the hardware interrupt the CPU? What happens - memory registers? Special pins on the CPU...what EXACTLY?

    • @hydrochloricacid2146
      @hydrochloricacid2146 6 ปีที่แล้ว +2

      Grundibular the implementation varies a bit depending on the cpu itself, but generally speaking, the CPU will have an interrupt controller. When the controller itself receives an interrupt from a device, such as a key press, it will force the processor to save its state and jump to a special part of memory called an interrupt vector table. This table will then tell the cpu where to jump next, into what is called an interrupt service routine, which actually handles the new data. Once this is done, the cpu resumes its previous work.

    • @RWoody1995
      @RWoody1995 5 ปีที่แล้ว +1

      if its a USB keyboard it doesn't interrupt the CPU, PS/2 keyboards do but USB ones rely once again on polling. USB devices communicate by sending 1 frame of data every 1/1000th of a second, this is why many gaming keyboards; in search of a gimmick to make themselves appear advantageous over normal ones... claim an update rate of 1000hz, simply they just send data out on every USB frame, most keyboards update at 125hz because 125 is 1/8th of 1000 so they only need to update on every 8th frame.

    • @hydrochloricacid2146
      @hydrochloricacid2146 5 ปีที่แล้ว

      @@RWoody1995 technically speaking, your software does receive USB interrupts. They just aren't generated by the keyboard.
      To get the load off the CPU, dedicated hardware polls the keyboard at regular intervals, and sends an interrupt to the system when a change occurs

    • @dudeabideth4428
      @dudeabideth4428 4 ปีที่แล้ว

      I remember I was asked this in a interview. I got to the interrupt handler in three sentences or less .
      So is the key value delivered to the current application? What’s the api for it to read ? It’s reading it using an api like a file ?

    • @ThatBrubakerFellow
      @ThatBrubakerFellow 4 ปีที่แล้ว

      Most new motherboards that I'm aware of don't have a true PS/2 port. It has a built-in adapter. USB I believe.

  • @hamditrimech9299
    @hamditrimech9299 6 ปีที่แล้ว

    hi, I would like to develop a language pack, then add an engine work in the background, which will works like a sentences corrector, all what I found is about how to install a language pack, any idea where to start ? .

  • @DerUnbekannte
    @DerUnbekannte 6 ปีที่แล้ว

    In this line scanning model, what happens when I press a key in the current row, one below on the same column, and one more on the same row as the second key. Do I get a false detection on the scanned row?

  • @littlemikey46
    @littlemikey46 6 ปีที่แล้ว +42

    How can a computer expert not like the model M? It's perfect!

    • @RaymondHng
      @RaymondHng 6 ปีที่แล้ว +1

      I guess he's not a touch typist. I'm typing this on a Model M.

    • @YellowToad
      @YellowToad 4 ปีที่แล้ว

      @@RaymondHng me too

  • @SecularMentat
    @SecularMentat 6 ปีที่แล้ว

    I rather enjoy this episode. I like the basic breakdowns of computers into their electronic components.

  • @CarterColeisInfamous
    @CarterColeisInfamous 6 ปีที่แล้ว +1

    did you even talk about debouncing the button signal? i might have missed it

  • @jjbailey01
    @jjbailey01 4 ปีที่แล้ว

    What I want to know is what happens when I press the key?

  • @christianmonturanoii6539
    @christianmonturanoii6539 ปีที่แล้ว

    How do they mold the shape of the letter under rhe keyboard ? I don't know how to ask this question it's hard to find aomone that can explain. So when a computer is built how do they mold all the letters into the computer so that when I press the letter x it shows up on the screen there isn't a little mold of rhe letter x under the button lol how do rheu fiest get the symbols to show up on the screen from the keyboard?

  • @webchimp
    @webchimp 6 ปีที่แล้ว +3

    "And this is basically the brains of the keyboard..."
    That's just some PCB track with gaps in, you've already looks at "the brains of the keyboard" on the other side.

    • @0LoneTech
      @0LoneTech 6 ปีที่แล้ว +1

      Yep, those were the feelers.

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 6 ปีที่แล้ว

    3:34 What about “buckling spring”, e.g. Cherry MX switches?

  • @xYuki91x
    @xYuki91x 3 ปีที่แล้ว

    say I press 3 keys at the exact same time of which 2 are on the same line vertically and the other one is in the same line horizontally with one of those. How can my keyboard know if I pressed 3 keys and not only 2? Or perhaps I even pressed 4 keys at the same time? How can it tell the difference?

  • @lawrencedoliveiro9104
    @lawrencedoliveiro9104 6 ปีที่แล้ว

    2:06 Or there would be, if your hardware implemented “n-key rollover”, which means it can distinguish every possible combination of keys being pressed at once. Not sure if current keyboard hardware actually supports that.

  • @procactus9109
    @procactus9109 6 ปีที่แล้ว

    huh, The video was cut short. I assume there is a part 2.

  • @SearchingForOurName
    @SearchingForOurName 6 ปีที่แล้ว

    Amazing!

  • @AndresRodriguezGuapacha
    @AndresRodriguezGuapacha 6 ปีที่แล้ว

    Off topic, but can you create a video about the SWARM robots project from Rolls Royce, the Universities of Nottingham and Harvard for car engine inspections?

  • @LPrulzcrossover
    @LPrulzcrossover ปีที่แล้ว

    Hmm one question remains for me: Back in the days, why was I able to boost and steer right at the same time in Need for Speed but not able to boost and steer left (shift + arrow keys)? And why was my friend able to do it on his computer with his keyboard?

  • @NilayInel
    @NilayInel ปีที่แล้ว

    Neden türkçe altyazı sadece 2 dk var ancak oraya kadar izler diye mi düşündünüz yoksa 2. dk dan sonra İng. mi anlamaya başlamamız gerekiyordu:

  • @DanielPianoful
    @DanielPianoful 6 ปีที่แล้ว +17

    How dare you saying that about the beloved, eternal, all clacky Model M. Heresy!

  • @sethother8012
    @sethother8012 4 ปีที่แล้ว

    At 1:20, he’s trying to begin explaining to us how the circuitry of the keyboard receives a signal, only to be interrupted and asked how many keys are possible to be pressed. Still laughing.

  • @stopthephilosophicalzombie9017
    @stopthephilosophicalzombie9017 6 ปีที่แล้ว +1

    I would have liked to see more on the software side.

  • @vageeshprasadb6773
    @vageeshprasadb6773 6 ปีที่แล้ว +1

    Awesome.

  • @space8862
    @space8862 2 ปีที่แล้ว +1

    Has someone already roasted this guy?

  • @SeanKD_Photos
    @SeanKD_Photos 6 ปีที่แล้ว +13

    Dose this guy not know about the modern mechanical keyboard market? Like come on

    • @neatoelectro3687
      @neatoelectro3687 6 ปีที่แล้ว +5

      of course he does. that's why he said he just started a flame war when He mentioned the Model M.

    • @MsHojat
      @MsHojat 5 ปีที่แล้ว +2

      Model M isn't a modern mechanical keyboard though, so it's not really proof that he's aware of the modern mechanical keyboard movement/fad.

  • @Thermophobe
    @Thermophobe 6 ปีที่แล้ว +25

    what a baller! got 2 imacs instead of two monitors and a mac

    • @ragnabob
      @ragnabob 6 ปีที่แล้ว +1

      I lol'ed!!! :D

    • @TruthNerds
      @TruthNerds 5 ปีที่แล้ว

      Maybe he's particularly decadent and uses one of them in target display mode for the other…

  • @paradonym
    @paradonym 6 ปีที่แล้ว

    but everytime if you mention interrupts - it's nice to explain that modern PCs just have four to eight CPUs in - quickly explaining that multicore is just an array of actual CPUs (cores) in one part of the PC.

  • @lewisharp6785
    @lewisharp6785 5 ปีที่แล้ว

    This helped me decipher the difference between having a pathological or spiritual entity controlling the other end of the conversation when taking to an Artificially intellegent source and having the genuine thing. Thank you. I'm a little paranoid.

  • @pierreabbat6157
    @pierreabbat6157 6 ปีที่แล้ว +2

    On the Apple ][, if you press 1, 2, and 3 at the same time, it would also get an S, or something like that.

  • @x3ICEx
    @x3ICEx 6 ปีที่แล้ว

    This is part 1, right? Did not even mention interrupts yet.

  • @berrabe3917
    @berrabe3917 6 ปีที่แล้ว +2

    can you guys add subtitle?

  • @aletoledo1
    @aletoledo1 6 ปีที่แล้ว +1

    I liked at the end how his example of a computer game was something from 25 years ago. I bet half the viewers are younger than that game.

    • @CorrosiveCitrus
      @CorrosiveCitrus 6 ปีที่แล้ว

      he could have been refering to quake champions - or at least heard about it which is why quake was at the forefront of his mind :)

  • @myusernameskitty1230
    @myusernameskitty1230 2 ปีที่แล้ว

    dangit now i cant type how helpful this is

  • @okaro6595
    @okaro6595 6 ปีที่แล้ว

    In the DOS era the interrupt just interpreted the scan code and put the scan code and the ASCII code in a buffer and then it was for the software to check if there were characters in the buffer. Is it somehow more sophisticated with Windows?

    • @gdclemo
      @gdclemo 2 ปีที่แล้ว

      In Windows, the currently focused window gets sent a message when a key is pressed. There is WM_KEYUP and WM_KEYDOWN for the "key pressed" or "key released" messages (including repeats if you hold down a key) and WM_CHAR when the OS converts one or more keypresses into a character, depending on the current language (this can get very complicated for languages with lots of characters like Japanese). The application typically passes control to the OS and asks it to wake it up when there's a new message for it.

  • @lesthompson608
    @lesthompson608 6 ปีที่แล้ว

    There are different codes called make and break codes for when a key is pressed vs released.

  • @albertwilliams5532
    @albertwilliams5532 3 ปีที่แล้ว

    Your are doing a great job! One recommendation, English subtitles please..couldn't get the accent right!

  • @lumpyfishgravy
    @lumpyfishgravy 6 ปีที่แล้ว +4

    I love it. He was all ready to rock on until ... that wonderfully cryptic question. Spent the rest of the video talking about the hardware / software interface.
    Yes, I am a firmware engineer.

  • @johntitor3860
    @johntitor3860 3 ปีที่แล้ว

    you don't need a microcontroller though, you can scan using a 555 timer and counter IC, then run the result of the matrix through various logic gates to create a binary code output, I guess this could get quite complex when dealing with a computer keyboard, I have only done it with a numeric keypad. Anyway I guess then what happens is the result updates a register, and whenever a key press is detected to have occurred, an interrupt is sent to the CPU periodically, the CPU then reads your keyboard register when it wants to.

  • @kranser
    @kranser 6 ปีที่แล้ว +1

    You mentioned when a key is released, the hardware would send a signal to the computer to say a key release event has happened - but how does the HW know a key is released, would it not need some kind of memory to check which keyboard link lines were being pressed at the previous scan?

    • @0LoneTech
      @0LoneTech 6 ปีที่แล้ว +2

      Quite right! That's part of what the program in that microcontroller handles. USB keyboards process things slightly differently, in that they report a list of currently pressed keys instead of press/release events.

    • @kranser
      @kranser 6 ปีที่แล้ว

      Thanks LoneTech. So the microcontroller is part of the keyboard, am I correct? So the Computer OS does not need to monitor for key presses, just wait for a key pressed/released interrupt event, yes?

    • @hydrochloricacid2146
      @hydrochloricacid2146 6 ปีที่แล้ว

      kranser correct. Seperate interrupts are sent for key press and release.

  • @RamkrishanYT
    @RamkrishanYT 6 ปีที่แล้ว +1

    make a second video explaining the software sides of it

  • @xotmatrix
    @xotmatrix 6 ปีที่แล้ว +1

    "I like my keyboards like I like my peas: soft and mushy."

  • @laurenhahn8569
    @laurenhahn8569 6 ปีที่แล้ว +6

    A letter appears on the screen. Next question.

    • @gman6055
      @gman6055 6 ปีที่แล้ว

      Lauren Hahn end of story, video length = 2 seconds. 12 minutes and 26 seconds saved :) genius

  • @unlokia
    @unlokia 6 ปีที่แล้ว

    What's the ASCII code for the "Any" key?

  • @JohnnyThousand605
    @JohnnyThousand605 6 ปีที่แล้ว +1

    3:45 shots fired! XD

  • @Seryosin
    @Seryosin 5 ปีที่แล้ว

    Press F to Pay Respects

  • @ashleyjaytanna1953
    @ashleyjaytanna1953 2 ปีที่แล้ว

    Somewhere out there when a key is pressed.... a paradise

  • @Kersich86
    @Kersich86 6 ปีที่แล้ว +2

    Appropriate quake reference is appropriate😀

  • @ChrisWMF
    @ChrisWMF 2 ปีที่แล้ว

    What if the user is a gamer and they need the computer to know that several keys are being pressed at the same time. Isn't there some cases where some key strokes can confuse this system since they overlap in the key matrix?

  • @arthurmarek8418
    @arthurmarek8418 5 ปีที่แล้ว

    Lineprinter paper! Reminds me of computer science A level in the seventies...cool!

  • @b1aflatoxin
    @b1aflatoxin 6 ปีที่แล้ว

    Hmmm, what about keyboard polyphony? From experience, even cheap keyboards have 5 key polyphony (five key-presses can be performed at the same time). ???
    I'm thinking it has to do with the microcontroller being able to differentiate between micro-second delay times that out brains and hands can not. ???
    _Edit:_ This question stems from my experience with DAW's and VST's in music production. After thinking about it more, ...it's probably a software thing. ;)
    But I'm still curious.

  • @Those_Weirdos
    @Those_Weirdos 2 ปีที่แล้ว

    I like how the subtitles just give up at around 2:20.

  • @patsonical
    @patsonical 6 ปีที่แล้ว +1

    Part 2 when? I wanna know how a UNIX system handles these

    • @marcel151
      @marcel151 3 ปีที่แล้ว

      Just how any other OS handles it? Throw a keymap on it and display the pressed key.

  • @videogamemusicandfunstuff4873
    @videogamemusicandfunstuff4873 5 ปีที่แล้ว +1

    3:33 haha, I'm getting stressed just thinking about how much trouble it's going to be to put the keyboard back together after the video

  • @Melvin420x12
    @Melvin420x12 5 ปีที่แล้ว

    Now I understand why in javascript you can't just ask if "W" is pressed, but instead check if the keyboard tells if a key is pressed and if that key is coincidentally keyCode 87 and then ask if a key is released and if that was coincidentally also keyCode 87.

  • @Andrew-gu8uw
    @Andrew-gu8uw 6 ปีที่แล้ว

    but can you do it in 0.5x a presses?

  • @Jonathansyoutube
    @Jonathansyoutube 6 ปีที่แล้ว

    If I heard him correctly, 2 to the 100 keyboard combinations is a number greater than the number of atoms in the universe.

  • @TheRealFaceyNeck
    @TheRealFaceyNeck 6 ปีที่แล้ว

    The only thing missing from this video is Dr. Bagley literally dropping a microphone and walking off set.

  • @miran248
    @miran248 6 ปีที่แล้ว +1

    Anyone remember the times where you could push (at most) three keys simultaneously? :) My first computer would at that point freeze for the duration of beep (from the speaker at the bottom of the computer case) repeatedly until some keys were released.

    • @neatoelectro3687
      @neatoelectro3687 6 ปีที่แล้ว

      I had forgotten all about this. . . then you mentioned the beep.

  • @k1ngjulien_
    @k1ngjulien_ 6 ปีที่แล้ว +397

    As an r/MechanicalKeyboards member I am offended by his taste in keyboards....

    • @andljoy
      @andljoy 6 ปีที่แล้ว +1

      Hey its dome over PCB is basically a realforce in all but name !
      Myself i prefer a good beamspring, or some nice complicated alps.
      DT > Reddit :P

    • @charliethomson2789
      @charliethomson2789 6 ปีที่แล้ว +58

      He said "I like my keyboard soft and mushy" and I was like no no no no NO NO NO

    • @k1ngjulien_
      @k1ngjulien_ 6 ปีที่แล้ว +2

      quangluu96 I mean their videos are mostly software related so I get why he didn't go into too much detail.

    • @Chriva
      @Chriva 6 ปีที่แล้ว +15

      I presume he does actual work on his machines. Mechanical keyboards are usually frowned upon by coders due to their disturbing nature :) Sit in a cubicle etc with ten other people around you having those things and you'll understand why they're so hated

    • @LIES666
      @LIES666 6 ปีที่แล้ว +14

      You can get quiet mechanical keyswitches that are a decent compromise.

  • @jacopo4395
    @jacopo4395 2 ปีที่แล้ว

    Yeah subtitles!!

  • @jackodonnell3463
    @jackodonnell3463 2 ปีที่แล้ว

    Based on that fly shirt, I suppose the stereotype of computer scientist's being fashionably obtuse is only an American thing

  • @thedawnofslayer
    @thedawnofslayer 6 ปีที่แล้ว

    subtitles... where you are?

  • @ludovitche
    @ludovitche 5 ปีที่แล้ว

    How many years of printing paper from the 90s do you have left ?
    Or is that continuous stationery even older ? 80s ? :)
    Some guy in the purchase department really overdid it...

  • @vincei4252
    @vincei4252 6 ปีที่แล้ว

    I like my keys soft and mushy? Pah, no taste at all.
    D I SG R AC EF UL !

  • @sameyers2670
    @sameyers2670 6 ปีที่แล้ว

    Is there a reason why the QWERTY format was chosen for keyboards?

    • @romaliop
      @romaliop 6 ปีที่แล้ว +1

      It's a leftover from the mechanical type writer era. The letters were "scrambled" in a way that would minimize the amount of mechanical failures when pressing two letters next to each other in rapid succession(the pattern was optimized for the English language). The common myth says that it was to slow the typists down, but in fact it was to speed them up through less time spent on malfunctions and it doesn't really have an effect on typing speed after the typist gets used to it.

    • @sameyers2670
      @sameyers2670 6 ปีที่แล้ว

      romaliop Thank you

  • @ErikN1
    @ErikN1 6 ปีที่แล้ว +1

    I'm curious about why there is a swedish keyboard there. Seems a bit random, but being swedish myself I like it. What's the story?

    • @RaymondHng
      @RaymondHng 6 ปีที่แล้ว

      The Swedish keyboard layout has keys to generate the letters å, ä, and ö. Norwegian and Danish keyboard layouts generate å, ø, and æ.

    • @ErikN1
      @ErikN1 6 ปีที่แล้ว

      @@RaymondHng well, yes. But why does British computer science guys need that?

    • @RaymondHng
      @RaymondHng 6 ปีที่แล้ว

      Maybe he knows Swedish.

    • @ErikN1
      @ErikN1 6 ปีที่แล้ว

      Det är möjligt

  • @christianmonturanoii6539
    @christianmonturanoii6539 ปีที่แล้ว

    Cool 🖥

  • @maxemore
    @maxemore 3 ปีที่แล้ว

    This guy offended an entire group of pc users at once by saying he likes keys soft and mushy

  • @AlexAegisOfficial
    @AlexAegisOfficial 6 ปีที่แล้ว +1

    8:45 Are you telling that having the keyboard check itself for keypresses and telling the computer to check what was pressed only if the keyboard noticed that keypress beforehand, sent a signal to the computer, the computer checked back what was pressed is faster than constantly polling the keyboard. That makes no sense.

    • @grancubodemierda
      @grancubodemierda 6 ปีที่แล้ว

      Győri Sándor it makes perfect sense. The CPU is not constantly polling the keyboard, it is the keyboard that does the dirty polling work and tells the CPU when something happens (which is almost never from a CPU cycles point of view).
      Imagine you are waiting for an amazon package to come, would you go to the street every 2 minutes to check if the postman is there? Or rather do your usual stuff at home and just pay attention when somebody rings the bell?

    • @0LoneTech
      @0LoneTech 6 ปีที่แล้ว

      The message from the keyboard to the computer doesn't tell the computer to check what was pressed, typically. The message sent already holds that information. From the CPU's perspective, keypresses are very rare, and spending time looking for them there would make little sense, particularly as switching tasks is quite costly. The interrupt allows it to jump to the keyboard handling routine only when the keyboard has sent new information.

    • @AlexAegisOfficial
      @AlexAegisOfficial 6 ปีที่แล้ว

      No, purely from the perspective of speed, me checking the door every second while I'm standing there is faster than sitting on the couch and only getting up when the bell rings. Because getting to the door takes time too, and the delivery guy has to press the doorbell too. It's not efficient in any way. But certainly is faster.

    • @0LoneTech
      @0LoneTech 6 ปีที่แล้ว

      Yep, this tradeoff between polling and interrupts does exist! Interrupts cause a context switch, which involves saving some state and jumping to another routine, possibly waking up a CPU that was sleeping entirely. Spinning the CPU on a single task can achieve faster reaction times on many, but not all, processors (the exceptions tend to have hardware contexts, like SPARC register windows, ARM fast interrupts or XMOS threads). The point I was making is that the CPU receives the interrupt when the message has arrived; it is not involved while the keyboard is transferring, and does not need a round trip to interrogate the keyboard. It's more like the mail man leaves the note at the desk you're already working than you answering the bell. (On PS/2, there's a high risk the CPU is fast enough to switch back and forth for each byte, which can get costly as many messages are several bytes long.)

    • @dipi71
      @dipi71 6 ปีที่แล้ว

      On modern computers, USB driver stacks and USB controller chips connected via PCI to the rest of the chipset handle that type of packet- and event-driven communication. It’s a whole other level of complexity (for example, I have a keyboard with USB hub where a USB wireless mouse and thumbdrives are connected). Then there’s all kinds of graphics drivers, font-rendering algorithms, window-management software modules and other complications to traverse for the key press (or key release) to do something useful. The more you dig into these kind of things, the more the mind boggles!

  • @1992dmk
    @1992dmk 4 ปีที่แล้ว

    What about shift??