Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(some?) Unicode Doesn't Work #27

Closed
frioux opened this issue Jul 15, 2013 · 6 comments
Closed

(some?) Unicode Doesn't Work #27

frioux opened this issue Jul 15, 2013 · 6 comments

Comments

@frioux
Copy link

frioux commented Jul 15, 2013

This applies to the partial rewrite branch. I recently got the zodiac set (http://www.pimpmykeyboard.com/marketplace.php) and thought it would be kinda fun to have a layer that would literally type those keys. Here is the patch I wrote to do that:

     diff --git a/firmware/keyboard/ergodox/layout/qwerty-kinesis-mod.c b/firmware/keyboard/ergodox/layout/qwerty-kinesis-mod.c
     index 3418ab1..e56cb05 100644
     --- a/firmware/keyboard/ergodox/layout/qwerty-kinesis-mod.c
     +++ b/firmware/keyboard/ergodox/layout/qwerty-kinesis-mod.c
     @@ -102,6 +102,8 @@ void keys__press__m_undo(void) {
          usb__kb__set_key(false, KEYBOARD__z_Z);
      }
      void R(m_undo)(void) {}
     +void P(m_aries)(void) { KF(type_string)( PSTR("♈") ); }
     +void R(m_aries)(void) {}

      // ----------------------------------------------------------------------------
      // layout
     @@ -145,7 +147,7 @@ static _layout_t _layout = {
         btldr,       F1,       F2,       F3,       F4,       F5,       F6,
        transp,   transp,   m_word,   transp,   transp,   transp,   transp,
        transp,   transp,   transp,   transp,   transp,   transp,
     -  transp,   transp,      del,   transp,   transp,  m_bword,   transp,
     +  transp, lpupo2l2,      del,   transp,   transp,  m_bword,   transp,
        transp,   transp,   transp,   transp,   transp,
                                                                    transp,   transp,
                                                          transp,   transp,   transp,
     @@ -166,7 +168,7 @@ static _layout_t _layout = {
      // macro, unused,
             K,    nop,
      // left hand ...... ......... ......... ......... ......... ......... .........
     -   btldr,      nop,      nop,      nop,      nop,      nop,      nop,
     +     nop,      m_aries,  nop,      nop,      nop,      nop,      nop,
           nop,      nop,      nop,      nop,      nop,      nop,      nop,
           nop,      nop,      nop,      nop,      nop,      nop,
           nop,      nop,      nop,      nop,      nop,      nop,      nop,

When I do hit the Aries key with the appropriate push keys held down it sends a set of control characters that interact poorly with pretty much every application.

Clearly this isn't super important but I figure that if it doesn't work here there may be real applications that it doesn't work for.

@benblazak
Copy link
Owner

I've been meaning to mess with that function a little bit, to hopefully help it work with Windows and OS X. But I just remembered that you were the one who started this thread, which makes me think your problem's not with Windows. If you're running OS X, it should work. If Linux, I'm really not sure (since I haven't made time/space to get Linux onto my Mac yet), but I suspect you'll have to modify the part of the implementation of KF(type_string) responsible for sending "unicode sequences" to send something recognizable by whatever flavor you're running. The macros you were originally using this function for only contained characters compatible with 7-bit ASCII, most of which this function treats as normal keypresses/keyreleases.

The documentation for KF(type_string) is here, if you haven't had time to look at it yet, and the implementation is here. You may also wish to see the small helper function just above it, for which i posted a replacement in your thread on Geekhack (though... I haven't had a chance to test it and push to github yet, and I'm not sure if it would make a difference in your situation).

Meanwhile, what OS are you using? And what exactly do you mean by "the appropriate push keys" being held down when pressing the Aries key? Unless those are layer keys that you're holding down, that may be the problem.

OT: Pretty cool that the zodiac sets are "Courtesy of fREW" :)

@frioux
Copy link
Author

frioux commented Jul 15, 2013

I'll take a look at the code you linked to tonight to see if I can figure out how to solve this.

I'm in Ubuntu, so yeah, the one major OS you haven't tested against. As for the "push" keys, I expect I'll type these zodiac keys like, 2 times when showing friends, and then never again, so I put them on layer three. I get confused by changing the state of my keyboard, so my layers are triggered by holding down a key. So to type a zodiac key I press and hold both of the layer1 key and the z key.

Just to make sure I put it in layer 0 and it didn't work. I went ahead and pushed the commit so you can look at it if you want: frioux@d8436a4

Yeah, it was pretty cool that they did that. They actually gave me a free set for coming up with the idea and placing/sizing the legends :D

@benblazak
Copy link
Owner

If you're running Ubuntu with Gnome, you might want to see this part of the Wikipedia entry on unicode input. My guess is that if you change the start sequence to press control + press shift + press u + release u + release shift + release control, and end sequence to press space + release space, things will work. But then those codes will be incompatible with Windows and OS X, if you ever plug your computer into a non-Linux (or perhaps even non-Gnome) system. Sorry for the trouble... Please let me know if this works though (or if something else does), and I'll try to get it in there as an option for others. Thanks :)

@tmk
Copy link

tmk commented Jul 16, 2013

Sending Unicode? Interesting.

I found a HID usage page for Unicode. If I understand it correctly this is a standard method to send Unicode which is independent of OS. But I'm not sure whether major OS's have support for this usage page or not.
http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf (page 108)

benblazak, do you have experience of this?

@benblazak
Copy link
Owner

:)

I've seen that usage page, and I did my best to try it out a little while ago. I wasn't able to get it working though... I'm really not sure whether because its not supported or because I don't know what I'm doing with USB stuff yet. I feel like both are likely true.

I figured I'd try again later, just in case, after I'd learned a bit more. Alternately, if you think it's worth trying before me (since you already know what's going on), I'll be curious to see whether it works.

@benblazak
Copy link
Owner

(Put a note in the source - I'll see if I can add the little bit of linux code later, perhaps with a compilation option, not sure yet. Issue closed for now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants